protected GridCoverage2D execute() { return CoverageFactoryFinder.getGridCoverageFactory(null) .create( "name", PlanarImage.wrapRenderedImage( RasterSymbolizerTest.getSynthetic(Double.NaN)), new GeneralEnvelope( new double[] {-90, -180}, new double[] {90, 180}), new GridSampleDimension[] { new GridSampleDimension( "sd", new Category[] { new Category("", Color.BLACK, 0) }, null) }, null, null); } };
/** * Returns a set of all available implementations for the {@link GridCoverageFactory} interface. * * @param hints An optional map of hints, or {@code null} if none. * @return Set of available grid coverage factory implementations. * @since 2.4 */ public static synchronized Set<GridCoverageFactory> getGridCoverageFactories(Hints hints) { hints = mergeSystemHints(hints); return new LazySet<GridCoverageFactory>( getServiceRegistry().getFactories(GridCoverageFactory.class, null, hints)); }
private GridCoverage2D createCoverage() { GridCoverageFactory gcf = CoverageFactoryFinder.getGridCoverageFactory(null); float[][] matrix = new float[WIDTH][WIDTH]; for (int i = 0; i < WIDTH; i++) { for (int j = 0; j < WIDTH; j++) { matrix[i][j] = i + j; } } return gcf.create("coverage", matrix, env); }
destinationEnvelope); destinationEnvelopeWGS84 .setCoordinateReferenceSystem(DefaultGeographicCRS.WGS84); } else { destinationEnvelopeWGS84 = new GeneralEnvelope( destinationEnvelope); destinationEnvelopeWGS84 = new GeneralEnvelope( destinationEnvelope); final GridSampleDimension [] sd= new GridSampleDimension[numBands]; for(int i=0;i<numBands;i++) { sd[i]= new GridSampleDimension(TypeMap.getColorInterpretation(finalImage.getColorModel(), i).name()); GridCoverageFactory factory = CoverageFactoryFinder.getGridCoverageFactory(hints); finalGC = factory.create( "opacity_"+symbolizerGC.getName().toString(), finalImage,
GridSampleDimension[] bands = inputCoverage.getSampleDimensions(); double[] nodataValues = bands[0].getNoDataValues(); Object noData = nodataValues == null ? Integer.MAX_VALUE : nodataValues[0]; properties.put("GC_NODATA", noData); GridCoverageFactory factory = CoverageFactoryFinder.getGridCoverageFactory(null); return factory.create(inputCoverage.getName(), inputImage, Extent, bands, null, properties);
this.coverageFactory = CoverageFactoryFinder.getGridCoverageFactory(this.hints); new GeneralEnvelope( new Rectangle2D.Double( env.getMinX(), env.getMaxX() - env.getMinX(), env.getMaxY() - env.getMinY())); this.originalEnvelope.setCoordinateReferenceSystem(crs); new GridEnvelope2D( new Rectangle( (int) Math.round(originalEnvelope.getSpan(0) / highestRes[0]), (int) Math.round(originalEnvelope.getSpan(1) / highestRes[1])));
new GridSampleDimension("classification", new Category[] {Category.NODATA}, null); final GridCoverageFactory factory = CoverageFactoryFinder.getGridCoverageFactory(GeoTools.getDefaultHints()); HashMap<String, Object> properties = new HashMap<String, Object>() { org.geotools.coverage.util.CoverageUtilities.setROIProperty(properties, worker.getROI()); final GridCoverage2D output = factory.create( "reclassified", indexedClassification,
public MBTilesReader(Object source, Hints hints) throws IOException { sourceFile = MBTilesFormat.getFileFromSource(source); MBTilesFile file = new MBTilesFile(sourceFile); metadata = file.loadMetaData(); try { bounds = ReferencedEnvelope.create(metadata.getBounds(), WGS_84) .transform(SPHERICAL_MERCATOR, true); } catch (Exception e) { bounds = null; } originalEnvelope = new GeneralEnvelope(bounds == null ? WORLD_ENVELOPE : bounds); long maxZoom; try { maxZoom = file.maxZoom(); } catch (SQLException e) { throw new IOException(e); } long size = Math.round(Math.pow(ZOOM_LEVEL_BASE, maxZoom)) * DEFAULT_TILE_SIZE; highestRes = new double[] {WORLD_ENVELOPE.getSpan(0) / size, WORLD_ENVELOPE.getSpan(1) / size}; originalGridRange = new GridEnvelope2D(new Rectangle((int) size, (int) size)); coverageFactory = CoverageFactoryFinder.getGridCoverageFactory(this.hints); crs = SPHERICAL_MERCATOR; }
/** * Returns the factory to use for creating new {@link GridCoverage2D} objects. * * @since 2.2 */ protected static GridCoverageFactory getFactory(final Hints hints) { return CoverageFactoryFinder.getGridCoverageFactory(hints); } }
(i == visibleBand) ? image.getColorModel() : band.getColorModel(); if (!(candidate instanceof IndexColorModel)) { if (!bands[i].equals(band)) { bands[i] = band; colorChanged = true; new NullOpImage(image, layout, null, OpImage.OP_COMPUTE_BOUND); final GridCoverage2D target = CoverageFactoryFinder.getGridCoverageFactory(GeoTools.getDefaultHints()) .create( visual.getName(), newImage,
final GridSampleDimension outSampleDimension = new GridSampleDimension("classification", new Category[] { Category.NODATA }, null).geophysics(true); final GridCoverageFactory factory = CoverageFactoryFinder.getGridCoverageFactory(null); final GridCoverage2D output = factory.create("reclassified", indexedClassification, coverage .getGridGeometry(), new GridSampleDimension[] { outSampleDimension }, new GridCoverage[] { coverage }, new HashMap<String,Double>(){{
CoverageFactoryFinder.getGridCoverageFactory(GeoTools.getDefaultHints()); GridCoverage2D coverage2D = factory.create(name, writableRaster, writeEnvelope); return coverage2D;
GridSampleDimension[] bands = inputCoverage.getSampleDimensions(); double[] nodataValues = bands[0].getNoDataValues(); Object noData = nodataValues == null ? Integer.MAX_VALUE : nodataValues[0]; properties.put("GC_NODATA", noData); GridCoverageFactory factory = CoverageFactoryFinder.getGridCoverageFactory(null); return factory.create(inputCoverage.getName(), outputImage, Extent, bands, null, properties);
GridSampleDimension band = null; band = new GridSampleDimension("Dimension", new Category[] { nan, values }, null); bands = new GridSampleDimension[] { band }; properties.put("GC_NODATA", Double.valueOf(noDataValue)); GridCoverageFactory factory = CoverageFactoryFinder.getGridCoverageFactory(null); return factory.create(name, tiledImage, coverageExtent, bands, null, properties);
new GeneralEnvelope(new ReferencedEnvelope(envelope, this.destinationCRS)); this.gridCoverageFactory = CoverageFactoryFinder.getGridCoverageFactory(this.hints);
CoverageFactoryFinder.getGridCoverageFactory(defHints));
final ColorModel candidate = (i == visibleBand) ? image.getColorModel() : band.getColorModel(); if (!(candidate instanceof IndexColorModel)) { if (!bands[i].equals(band)) { bands[i] = band; colorChanged = true; final GridCoverage2D target = CoverageFactoryFinder.getGridCoverageFactory(null).create( visual.getName(), newImage, visual.getCoordinateReferenceSystem2D(),
final GeneralEnvelope envelope = new GeneralEnvelope(bounds); final RenderedImage image = ImageIO.read(TestData.getResource(this, path)); final int numBands = image.getSampleModel().getNumBands(); bands[i] = new GridSampleDimension("band " + i); org.geotools.coverage.CoverageFactoryFinder.getGridCoverageFactory( GeoTools.getDefaultHints()); envelope.setCoordinateReferenceSystem(crs); return factory.create(filename, image, envelope, bands, null, null);
@Override public GridCoverage2D read(GeneralParameterValue[] parameters) throws IllegalArgumentException, IOException { assertTrue( Arrays.stream(parameters) .anyMatch( p -> "Bands".equals(p.getDescriptor().getName().toString()) && Arrays.equals( expectedBands, (int[]) ((ParameterValue) p) .getValue()))); // Create a solid color single band coverage BufferedImage bi = new BufferedImage(100, 100, BufferedImage.TYPE_BYTE_GRAY); Graphics2D graphics = bi.createGraphics(); graphics.setColor(Color.WHITE); graphics.fillRect(0, 0, bi.getWidth(), bi.getHeight()); graphics.dispose(); GridCoverage2D coverage = CoverageFactoryFinder.getGridCoverageFactory(null) .create("test", bi, getOriginalEnvelope()); return coverage; } }
GridSampleDimension[] bands = inputCoverage.getSampleDimensions(); double[] nodataValues = bands[0].getNoDataValues(); Object noData = nodataValues == null ? Integer.MAX_VALUE : nodataValues[0]; properties.put("GC_NODATA", noData); GridCoverageFactory factory = CoverageFactoryFinder.getGridCoverageFactory(null); return factory.create(inputCoverage.getName(), outputImage, Extent, bands, null, properties);