/** Returns the original source file, is present in the metadata, and if the coverage */ private File getSourceFile(GridCoverage2D coverage) { final Object fileSource = coverage.getProperty(AbstractGridCoverage2DReader.FILE_SOURCE_PROPERTY); if (fileSource != null && fileSource instanceof String) { File file = new File((String) fileSource); if (file.exists()) { GeoTiffReader reader = null; try { reader = new GeoTiffReader(file); GeneralEnvelope originalEnvelope = reader.getOriginalEnvelope(); Envelope envelope = coverage.getEnvelope(); if (originalEnvelope.equals(envelope, 1e-9, false)) { GridCoverage2D test = reader.read(null); ImageUtilities.disposeImage(test.getRenderedImage()); return file; } } catch (Exception e) { // ok, not a geotiff! } finally { if (reader != null) { reader.dispose(); } } } } return null; }
/** * Utility method for extracting ROI property from input {@link GridCoverage2D}. * * @param coverage * @return A {@link ROI} object */ public static ROI getROIProperty(GridCoverage2D coverage) { // Searching for the ROI final Object roi = coverage.getProperty("GC_ROI"); // Returning it if present if (roi != null && roi instanceof ROI) { return (ROI) roi; } return null; }
/** * Utility method for extracting NoData property from input {@link GridCoverage2D}. * * @param coverage * @return A {@link NoDataContainer} object containing input NoData definition */ public static NoDataContainer getNoDataProperty(GridCoverage2D coverage) { // Searching for NoData property final Object noData = coverage.getProperty(NoDataContainer.GC_NODATA); if (noData != null) { // Returning a new instance of NoDataContainer if (noData instanceof NoDataContainer) { return (NoDataContainer) noData; } else if (noData instanceof Double) { return new NoDataContainer((Double) noData); } } return null; }
/** * Check whether this source GridCoverage comes with a {@link Compositing} object which need to * be applied. */ private GridCoverage2D lookForCompositing(GridCoverage2D source) { Object compositing = source.getProperty(KEY_COMPOSITING); if (compositing != null && compositing instanceof Compositing) { return ((Compositing) compositing) .composeGridCoverage( source, CoverageFactoryFinder.getGridCoverageFactory(hints)); } return source; } }
Object max = extrema.getProperty("maximum");
final Object noData = coverage.getProperty(NoDataContainer.GC_NODATA); if (noData != null && noData instanceof NoDataContainer) { return ((NoDataContainer) noData).getAsArray();
RenderedImage input = coverage.getRenderedImage(); Object roiObject = input.getProperty("ROI"); Object gcRoiObject = coverage.getProperty("GC_ROI"); if (!(roiObject instanceof ROI) && !(gcRoiObject instanceof ROI)) { Envelope env =
/** Return source {@link NetcdfDataset} for this granule or null if it does not have one. */ protected NetcdfDataset getSourceNetcdfDataset(GridCoverage2D granule) { URL sourceUrl = (URL) granule.getProperty(GridCoverage2DReader.SOURCE_URL_PROPERTY); if (sourceUrl != null) { try { return NetCDFUtilities.getDataset(sourceUrl); } catch (Exception e) { LOGGER.info( String.format( "Failed to open source URL %s as NetCDF/GRIB: %s", sourceUrl, e.getMessage())); } } return null; }
Object objNoData = srcCoverage.getProperty(noDataName.toString()); if (objNoData != null && objNoData instanceof Number) { return (Double) objNoData; } else { objNoData = srcCoverage.getProperty("GC_NODATA"); if (objNoData != null && objNoData instanceof Number) { return (Double) objNoData;
(List<ZoneGeometry>) output.getProperty(ZonalStatsDescriptor.ZS_PROPERTY); return value;
final Object noData=coverage.getProperty("GC_NODATA"); if(noData!=null&& noData instanceof Number){ return new double[]{((Double)noData).doubleValue()};
final Object fileSource = coverage.getProperty(AbstractGridCoverage2DReader.FILE_SOURCE_PROPERTY); if (fileSource != null && fileSource instanceof String) { File file = new File((String) fileSource);
@Override public GridCoverageWritable toWritable(final GridCoverage entry) { final Envelope env = entry.getEnvelope(); final DataBuffer dataBuffer = entry.getRenderedImage().copyData( new InternalWritableRaster( sampleModel.createCompatibleSampleModel(tileSize, tileSize), new Point())).getDataBuffer(); Persistable metadata = null; if (entry instanceof GridCoverage2D) { final Object metadataObj = ((GridCoverage2D) entry).getProperty(TILE_METADATA_PROPERTY_KEY); if ((metadataObj != null) && (metadataObj instanceof Persistable)) { metadata = (Persistable) metadataObj; } } return new GridCoverageWritable( new RasterTile(dataBuffer, metadata), env.getMinimum(0), env.getMaximum(0), env.getMinimum(1), env.getMaximum(1), env.getCoordinateReferenceSystem()); }
final Object fileSource = coverage.getProperty(AbstractGridCoverage2DReader.FILE_SOURCE_PROPERTY); if (fileSource != null && fileSource instanceof String) { location = (String) fileSource;
coverage.getProperty(GridCoverage2DReader.FILE_SOURCE_PROPERTY); if (fileSource != null && fileSource instanceof String) { location = (String) fileSource;
coverage = (GridCoverage2D) op.doOperation(params, null); javax.media.jai.Histogram hist = (Histogram) coverage .getProperty("histogram");
(javax.media.jai.Histogram) coverage.getProperty( Histogram.GT_SYNTHETIC_PROPERTY_HISTOGRAM);