public String getName() { return delegate.getName(); }
@Override public String answer() throws Throwable { return lookupGridFormat(covFile).getName(); } })
private void addCoverageFromPath(QName name, File coverage, String relpath, String styleName) throws Exception { coverageInfo(name, coverage, styleName); // setup the meta information to be written in the catalog AbstractGridFormat format = (AbstractGridFormat) GridFormatFinder.findFormat(coverage); namespaces.put(name.getPrefix(), name.getNamespaceURI()); coverageStoresNamespaces.put(name.getLocalPart(), name.getPrefix()); Map params = new HashMap(); params.put(CatalogWriter.COVERAGE_TYPE_KEY, format.getName()); params.put(CatalogWriter.COVERAGE_URL_KEY, relpath); coverageStores.put(name.getLocalPart(), params); }
/** Builds the default coverage contained in the current store */ public CoverageInfo buildCoverage(String coverageName) throws Exception { if (store == null || !(store instanceof CoverageStoreInfo)) { throw new IllegalStateException("Coverage store not set."); } CoverageStoreInfo csinfo = (CoverageStoreInfo) store; GridCoverage2DReader reader = (GridCoverage2DReader) catalog.getResourcePool() .getGridCoverageReader(csinfo, GeoTools.getDefaultHints()); if (reader == null) throw new Exception( "Unable to acquire a reader for this coverage with format: " + csinfo.getFormat().getName()); return buildCoverage(reader, coverageName, null); }
/** * Builds the default coverage contained in the current store * * @param nativeCoverageName the native name for the coverage * @param specifiedName the published name for the coverage. If null, the name will be * determined from the coverage store. * @return coverage for the specified name * @throws Exception if the coverage store was not found or could not be read, or if the * coverage could not be created. */ public CoverageInfo buildCoverageByName(String nativeCoverageName, String specifiedName) throws Exception { if (store == null || !(store instanceof CoverageStoreInfo)) { throw new IllegalStateException("Coverage store not set."); } CoverageStoreInfo csinfo = (CoverageStoreInfo) store; GridCoverage2DReader reader = (GridCoverage2DReader) catalog.getResourcePool() .getGridCoverageReader(csinfo, GeoTools.getDefaultHints()); if (reader == null) throw new Exception( "Unable to acquire a reader for this coverage with format: " + csinfo.getFormat().getName()); return buildCoverageInternal(reader, nativeCoverageName, null, specifiedName); }
/** Keys for overriding default layer properties */ public static class StyleProperty<T> { T get(Map<StyleProperty, Object> map, T def) { return map != null && map.containsKey(this) ? (T) map.get(this) : def; } public static StyleProperty<String> FORMAT = new StyleProperty<String>(); public static StyleProperty<Version> FORMAT_VERSION = new StyleProperty<Version>(); public static StyleProperty<LegendInfo> LEGEND_INFO = new StyleProperty<LegendInfo>(); }
+ coverageFile.toString() + " with format" + format.getName(); throw new RuntimeException(message, e); + coverageFile.toString() + " with format " + format.getName()); writer.write("<supportedFormats nativeFormat = \"" + format.getName() + "\">\n"); writer.write("<formats>ARCGRID,ARCGRID-GZIP,GEOTIFF,PNG,GIF,TIFF</formats>\n"); writer.write("</supportedFormats>\n");
.andReturn(reader) .anyTimes(); expect(format.getName()).andReturn("TheFormat").anyTimes(); expect(format.getReadParameters()) .andReturn(new CustomFormat().getReadParameters())
throw new Exception( "Unable to acquire a reader for this coverage with format: " + csinfo.getFormat().getName());
if ("GeoTIFF".equals(f.getName())) { return f;
@Override public String getName() { return gridFormat().getName(); }
@Override public String getName() { return gridFormat().getName(); }
@Override public CoverageStoreInfo createStore(ImportData data, WorkspaceInfo workspace, Catalog catalog) throws IOException { File f = file(data); if (f == null) { return null; } CatalogBuilder cb = new CatalogBuilder(catalog); cb.setWorkspace(workspace); CoverageStoreInfo store = cb.buildCoverageStore(data.getName()); store.setURL(f.toURI().toURL().toString()); store.setType(gridFormat().getName()); return store; }
@Override public CoverageStoreInfo createStore(ImportData data, WorkspaceInfo workspace, Catalog catalog) throws IOException { File f = file(data); if (f == null) { return null; } CatalogBuilder cb = new CatalogBuilder(catalog); cb.setWorkspace(workspace); CoverageStoreInfo store = cb.buildCoverageStore(data.getName()); store.setURL(relativeDataFileURL(f.toURI().toURL().toString(), catalog)); store.setType(gridFormat().getName()); return store; }
/** * Grabs the reader from the specified coverage * * @param ci * @throws IOException */ public static GridCoverage2DReader getCoverageReader(CoverageInfo ci) throws IOException, Exception { // get a reader for this coverage final CoverageStoreInfo store = (CoverageStoreInfo) ci.getStore(); final GridCoverageReader reader_ = ci.getGridCoverageReader(new DefaultProgressListener(), GeoTools.getDefaultHints()); if (reader_ == null) { throw new Exception( "Unable to acquire a reader for this coverage with format: " + store.getFormat().getName()); } final GridCoverage2DReader reader = (GridCoverage2DReader) reader_; return reader; }
store.setType(gridFormat().getName()); cb.setStore(store);