@Override public AbstractGridFormat createFormat() { return new GDALGeoTiffFormat(); } }
/** Creates an instance and sets the metadata. */ public GDALGeoTiffFormat() { super(new GeoTiffImageReaderSpi()); setInfo(); }
/** @see org.geotools.data.coverage.grid.AbstractGridFormat#getReader(Object, Hints) */ @Override public GDALGeoTiffReader getReader(final Object source, final Hints hints) { try { return new GDALGeoTiffReader(source, hints); } catch (final MismatchedDimensionException e) { final RuntimeException re = new RuntimeException(); re.initCause(e); throw re; } catch (final DataSourceException e) { final RuntimeException re = new RuntimeException(); re.initCause(e); throw re; } } }
+ ".tif"); if (geotiffFile.exists()) { final GDALGeoTiffReader reader = new GDALGeoTiffReader(geotiffFile); final GridCoverage2D coverage = reader.read(null); reader.dispose(); return new RasterBandData(entityId + "_" + bandName, coverage, reader, NO_DATA_VALUE);
if (writer == null) { final Map<String, String> metadata = new HashMap<>(); final String[] mdNames = reader.getMetadataNames(); if ((mdNames != null) && (mdNames.length > 0)) { for (final String mdName : mdNames) { metadata.put(mdName, reader.getMetadataValue(mdName));
public static void main(final String[] args) throws IOException { File gdalDir = null; if ((args != null) && (args.length > 0) && (args[0] != null) && !args[0].trim().isEmpty()) { gdalDir = new File(args[0]); // HP Fortify "Path Traversal" false positive // What Fortify considers "user input" comes only // from users with OS-level access anyway } else { gdalDir = new File(DEFAULT_TEMP_DIR, "gdal"); } if (gdalDir.exists() && gdalDir.isDirectory()) { File[] files = gdalDir.listFiles(); if (files != null && files.length > 1) { return; } else { LOGGER.error( "Directory " + gdalDir.getAbsolutePath() + " exists but does not contain GDAL, consider deleting directory or choosing a different one."); } } if (!gdalDir.mkdirs()) { LOGGER.warn("unable to create directory " + gdalDir.getAbsolutePath()); } install(gdalDir); }
gdalEnv = DEFAULT_BASE; if (isWindows()) { file = "gdal-1.9.2-MSVC2010-x64.zip"; url = new URL(gdalEnv + "/windows/MSVC2010/" + file);
FreeMarkerTemplateUtils.processTemplateIntoString(coverageNameTemplate, model); final File geotiffFile = DownloadRunner.getDownloadFile(band, landsatOptions.getWorkspaceDir()); final GDALGeoTiffReader reader = new GDALGeoTiffReader(geotiffFile); GridCoverage2D coverage = reader.read(null); reader.dispose(); if ((ingestOptions.getCoverageConverter() != null) && !ingestOptions.getCoverageConverter().trim().isEmpty()) {
final String[] mdNames = b.reader.getMetadataNames(); if ((mdNames != null) && (mdNames.length > 0)) { for (final String mdName : mdNames) { metadata.put(mdName, b.reader.getMetadataValue(mdName));
/** @see org.opengis.coverage.grid.GridCoverageReader#getFormat() */ public Format getFormat() { return new GDALGeoTiffFormat(); } }