Class GrassBinaryRasterReadHandler

    • Constructor Detail

      • GrassBinaryRasterReadHandler

        public GrassBinaryRasterReadHandler​(File cellFile)
        the constructor to build a GrassBinaryRasterReadHandler usable for reading grass rasters.
        Parameters:
        cellFile - the file of the raw raster data.
    • Method Detail

      • readRaster

        public WritableRaster readRaster​(ImageReadParam param,
                                         boolean useSubSamplingAsRequestedRowcols,
                                         boolean castDoubleToFloating,
                                         ProgressListener monitor)
                                  throws IOException,
                                         DataFormatException
        Reads a grass raster, adding the possibility to override subsampling.
        Parameters:
        param - the read parameters.
        useSubSamplingAsRequestedRowcols - a flag that gives the possibility to bypass the imageio subsampling mechanism. With GRASS maps this is often more performing 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: https://jai-imageio-core.dev.java.net /issues/show_bug.cgi?id=180
        Returns:
        the read raster
        Throws:
        IOException
        DataFormatException
      • parseHeaderAndAccessoryFiles

        public void parseHeaderAndAccessoryFiles()
                                          throws IOException
        Determines the metadata of the raster map.

        Reads the map type given a file and its mapset, the information from the header file in the cellhd directory and determines the geographic limits, format of the data, etc from the file. NOTE: for further informations about cell header files, read the package description.

        INFO: this is a reader method.

        Throws:
        IOException
      • getNativeRasterRegion

        public JGrassRegion getNativeRasterRegion()
        Getter for nativeRasterRegion.

        INFO: this is a reader method.

        Returns:
        the nativeRasterRegion.
      • getColorRules

        public List<String> getColorRules​(double[] range)
                                   throws IOException
        Getter for the colorrules.

        INFO: this is a reader method.

        Returns:
        the list of single colorrules.
        Throws:
        IOException
      • getCategories

        public List<String> getCategories()
                                   throws IOException
        Getter for the categories.

        INFO: this is a reader method.

        Returns:
        the attribute table as read in the categories file
        Throws:
        IOException
      • abort

        public void abort()
        sets the abortrequired flag to true.

        As soon as possible that should abort the reader.

      • isAborting

        public boolean isAborting()
        Getter for the abortrequired flag.
        Returns:
        the abortRequired flag.
      • setNoData

        public void setNoData​(double noData)
        Setter for the noData value.
        Parameters:
        noData - the nodata value to set.
      • getNoData

        public double getNoData()
        Getter for the noData value.
        Returns:
        the nodata value.
      • getCrs

        public CoordinateReferenceSystem getCrs()
                                         throws IOException
        Reads the crs definition for the map.

        The definition for grass maps is held in the location. Grass projection definitions are usually in a non parsable internal format. In JGrass we ask the user to choose the CRS. If the user doesn't do so, the CRS will result to be undefined.

        Returns:
        the CoordinateReferenceSystem for the map. Null if it is not defined.
        Throws:
        IOException - if there were problems in parsing the CRS file.
      • getRasterMapWidth

        public int getRasterMapWidth()
      • getRasterMapHeight

        public int getRasterMapHeight()
      • getRange

        public double[] getRange()