Class GrassCoverageReader

    • Constructor Detail

      • GrassCoverageReader

        public GrassCoverageReader​(Object input)
        Sets the input source to use to the given file object.

        The input source must be set before any of the query or read methods are used.

        input - the File to use for future decoding.
    • Method Detail

      • setParams

        public void setParams​(PixelInCell cellAnchor,
                              Interpolation interpolation,
                              boolean useSubSamplingAsColsRows,
                              boolean castDoubleToFloating,
                              ProgressListener monitor)
        Constructor for the GrassCoverageReader.
        cellAnchor - the object defining whether to assume the pixel value to be read in the grid's cell corner or center.
        interpolation - the type of interpolation to be used in the case some scaling or padding has to be done.
        useSubSamplingAsColsRows - a flag that gives the possibility to bypass the imageio subsampling mechanism. With GRASS maps this is often more performant in some boundary situations. In the case this flag is set to true, the subsampling values will be handled as the requested columns and rows.
        castDoubleToFloating - a flag that gives the possibility to force the reading of a map as a floating point map. This is necessary right now because of a imageio bug: /issues/show_bug.cgi?id=180.
        monitor - a monitor for logging purposes. This can be null, in which case a dummy one will be used.
      • readRaster

        public GridCoverage2D readRaster​(JGrassRegion region)
                                  throws IOException
        Performs the reading of the coverage.

        This method read the grass file with a special image I/O class. If the image support the tiling read the data with a special operation which are written for this case. The step are:

      • set the region in the world
      • set the region to read in the JAI coordinate
      • read the data directly with driver or, if isTiling is true, with the operation.
      • verify if the image cover whole the region, if not fill the rows and columns with padding (with the Border operation)
      • scale the image to return an image with the number of columns and rows equal to the requestedRegion
      • set the coverage (with the transformation from the JAI coordinate to the real world coordinate.

region - the regionto read. If null, the map is read in its original boundary and resolution.
the read coverage.