Class RasterLayer


  • public class RasterLayer
    extends Object
    RasterLayer provides Repast ValueLayer like functionality using geographic coordinates and can be displayed when part of a Geography instance. Contains an instance of a WritableGridCoverage2D that allows read and write capabilities on an underlying GridGoverage2D. Current write capability is limited to a single band. The WritableGridCoverage2D needs to be updated to allow multi-band writes. TODO GIS provide multiple band write capability.
    Author:
    Eric Tatara
    • Constructor Detail

      • RasterLayer

        public RasterLayer​(String name,
                           org.geotools.coverage.grid.GridCoverage2D gridCoverage)
        Create the RasterLayer from the provided GridCoverage2D. This is useful when creating GridCoverage2D from other readers or data types.
        Parameters:
        name -
        gridCoverage -
      • RasterLayer

        public RasterLayer​(org.geotools.coverage.grid.GridCoverage2D gridCoverage)
      • RasterLayer

        public RasterLayer​(String name,
                           File rasterfile)
      • RasterLayer

        public RasterLayer​(String name,
                           File rasterfile,
                           boolean forceLonLatAxisOrder)
        Create the RasterLayer using a raster file. The coverage returned by the file reader will be wrapped with a WritableGridCoverage instance so that this layer can be written to.
        Parameters:
        name - the name of the GeoValueLayer
        rasterfile - a georeferenced raster file such as GeoTif
        forceLonLatAxisOrder - forces lon,lat coordinate order on read
      • RasterLayer

        public RasterLayer​(String name,
                           int width,
                           int height,
                           org.geotools.geometry.jts.ReferencedEnvelope envelope)
    • Method Detail

      • getCRS

        public org.opengis.referencing.crs.CoordinateReferenceSystem getCRS()
      • setCRS

        public void setCRS​(org.opengis.referencing.crs.CoordinateReferenceSystem crs)
        Setting the layer CRS will project the coverage to the new CRS.
        Parameters:
        crs - target CoordinateReferenceSystem
      • getName

        public String getName()
      • getGridCoverage

        public org.geotools.coverage.grid.GridCoverage2D getGridCoverage()
      • getNumBands

        public int getNumBands()
      • getValue

        public Object getValue​(double x,
                               double y)
      • getIntegerGridValue

        public int getIntegerGridValue​(int x,
                                       int y)
      • getFloatGridValue

        public int getFloatGridValue​(int x,
                                     int y)
      • getDoubleGridValue

        public int getDoubleGridValue​(int x,
                                      int y)
      • getIntegerWorldValue

        public int getIntegerWorldValue​(double x,
                                        double y)
      • getFloatWorldValue

        public float getFloatWorldValue​(double x,
                                        double y)
      • getDoubleWorldValue

        public double getDoubleWorldValue​(double x,
                                          double y)
      • setWorldValue

        public void setWorldValue​(double x,
                                  double y,
                                  int value)
      • setWorldValue

        public void setWorldValue​(double x,
                                  double y,
                                  float value)
      • setWorldValue

        public void setWorldValue​(double x,
                                  double y,
                                  double value)
      • setGridValue

        public void setGridValue​(int x,
                                 int y,
                                 int value)
      • setGridValue

        public void setGridValue​(int x,
                                 int y,
                                 float value)
      • setGridValue

        public void setGridValue​(int x,
                                 int y,
                                 double value)