Package org.geotools.coverage.grid

Examples of org.geotools.coverage.grid.GridCoverageFactory.create()


                @SuppressWarnings("rawtypes")
                BufferedImage bi = new BufferedImage(image.getColorModel(), (WritableRaster) image
                        .getData(), false, new Hashtable());
                GridCoverageFactory fac = new GridCoverageFactory();

                GridCoverage2D c = fac.create(fileName, bi, env);
                coverage = new SoftReference<GridCoverage>(c);

            } catch (OutOfMemoryError e) {
                updateMemoryLevel();
            } catch (Exception t) {
View Full Code Here


        if (image == null) {
            return;
        }

        GridCoverageFactory factory = new GridCoverageFactory();
        GridCoverage2D coverage = (GridCoverage2D) factory.create("GridCoverage", image, tileEnvelope); //$NON-NLS-1$       

        CoordinateReferenceSystem mapCrs = getContext().getCRS();
        ReferencedEnvelope tileMapCrsEnvelope = tileEnvelope.transform(mapCrs, true);

        // determine screen coordinates of tiles
View Full Code Here

            }

            GridCoverageFactory factory = CoverageFactoryFinder.getGridCoverageFactory(null);
            GeneralEnvelope gridEnvelope = new GeneralEnvelope(mapProjection);
            gridEnvelope.setEnvelope(gridCoverageOrigin.x, gridCoverageOrigin.y, gridCoverageMaxX, gridCoverageMaxY);
            return factory.create(commonUrl.toString(), coverageImage, gridEnvelope, null, null, null);
        } catch (Exception e) {
            throw ExceptionUtils.getRuntimeException(e);
        }
    }
View Full Code Here

       
        GridCoverageFactory factory = CoverageFactoryFinder.getGridCoverageFactory(null);
        GeneralEnvelope gridEnvelope = new GeneralEnvelope(mapEnvelope.getCoordinateReferenceSystem());
        gridEnvelope.setEnvelope(mapEnvelope.getMinX(), mapEnvelope.getMinY(), mapEnvelope.getMaxX(), mapEnvelope.getMaxY());
        final String coverageName = getClass().getSimpleName();
        final GridCoverage2D gridCoverage2D = factory.create(coverageName, image, gridEnvelope, null, null, null);
       
        Style style = this.styleSupplier.load(httpRequestFactory, gridCoverage2D, mapContext);
        return Collections.singletonList(new GridCoverageLayer(gridCoverage2D, style));
    }
View Full Code Here

     
      // write down a fake geotiff with non-standard CRS
      GridCoverageFactory factory = new GridCoverageFactory();
            BufferedImage bi = new BufferedImage(10, 10, BufferedImage.TYPE_4BYTE_ABGR);
            ReferencedEnvelope envelope = new ReferencedEnvelope(0, 10, 0, 10,DefaultGeographicCRS.WGS84);
            GridCoverage2D test = factory.create("test", bi, envelope);
            GeoTiffWriter writer = new GeoTiffWriter(geotiff);
            writer.write(test, null);
            writer.dispose();
   
            // read
View Full Code Here

            for (int j = 0; j < WIDTH; j++) {
                matrix[i][j] = rand.nextFloat() * 255;
            }
        }

        return gcf.create("coverage", matrix, env);
    }

    private Style createCoverageStyle(String bandName) {
        StyleFactory sf = CommonFactoryFinder.getStyleFactory(null);
        FilterFactory2 ff = CommonFactoryFinder.getFilterFactory2(null);
View Full Code Here

                if(source.getProperties() != null) {
                    props.putAll(source.getProperties());
                }
                if(numActualBands==numSourceBands) {
                    final String name = "ce_coverage" + source.getName();
                    output = factory.create(
                  name,
                  finalImage,
                  (GridGeometry2D)source.getGridGeometry(),
                  source.getSampleDimensions(),
                  new GridCoverage[]{source},
View Full Code Here

                } else {
          // replicate input bands
          final GridSampleDimension sd[]= new GridSampleDimension[numActualBands];
          for(int i=0;i<numActualBands;i++)
            sd[i]=(GridSampleDimension) source.getSampleDimension(0);
          output = factory.create(
                  "ce_coverage"+source.getName().toString(),
                  finalImage,
                  (GridGeometry2D)source.getGridGeometry(),
                  sd,
                  new GridCoverage[]{source},
View Full Code Here

       
        // build the output sample dimensions, use the default value ( 0 ) as the no data
        final GridSampleDimension outSampleDimension = new GridSampleDimension("classification",
                new Category[] { Category.NODATA }, null).geophysics(true);
        final GridCoverageFactory factory = CoverageFactoryFinder.getGridCoverageFactory(GeoTools.getDefaultHints());
        final GridCoverage2D output = factory.create("reclassified", indexedClassification, coverage
                .getGridGeometry(), new GridSampleDimension[] { outSampleDimension },
                new GridCoverage[] { coverage }, new HashMap<String,Double>(){{
                  put("GC_NODATA",0d);
                }});
        return output;
View Full Code Here

                pY = pY - stepY;
            }

            // build the grid coverage
            GridCoverageFactory coverageFactory = new GridCoverageFactory();
            GridCoverage2D grid = coverageFactory.create("AreaGridCoverage", matrix, bounds);
            return grid;

        } catch (org.opengis.referencing.FactoryException ef) {
            throw new ProcessException("Unable to create the target CRS", ef);
        } catch (org.opengis.referencing.operation.TransformException et) {
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.