Class RasterBandAccessors

java.lang.Object
org.apache.sedona.common.raster.RasterBandAccessors

public class RasterBandAccessors extends Object
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static boolean
    bandIsNoData(org.geotools.coverage.grid.GridCoverage2D raster)
     
    static boolean
    bandIsNoData(org.geotools.coverage.grid.GridCoverage2D raster, int band)
    Returns true if the band is filled with only nodata values.
    static org.geotools.coverage.grid.GridCoverage2D
    getBand(org.geotools.coverage.grid.GridCoverage2D rasterGeom, int[] bandIndexes)
     
    static Double
    getBandNoDataValue(org.geotools.coverage.grid.GridCoverage2D raster)
     
    static Double
    getBandNoDataValue(org.geotools.coverage.grid.GridCoverage2D raster, int band)
     
    static String
    getBandType(org.geotools.coverage.grid.GridCoverage2D raster)
     
    static String
    getBandType(org.geotools.coverage.grid.GridCoverage2D raster, int band)
     
    static long
    getCount(org.geotools.coverage.grid.GridCoverage2D raster)
     
    static long
    getCount(org.geotools.coverage.grid.GridCoverage2D raster, int band)
     
    static long
    getCount(org.geotools.coverage.grid.GridCoverage2D raster, int band, boolean excludeNoDataValue)
     
    static double
    getSummaryStats(org.geotools.coverage.grid.GridCoverage2D rasterGeom, String statType)
     
    static double
    getSummaryStats(org.geotools.coverage.grid.GridCoverage2D rasterGeom, String statType, int band)
     
    static double
    getSummaryStats(org.geotools.coverage.grid.GridCoverage2D rasterGeom, String statType, int band, boolean excludeNoDataValue)
     
    static double[]
    getSummaryStatsAll(org.geotools.coverage.grid.GridCoverage2D raster)
     
    static double[]
    getSummaryStatsAll(org.geotools.coverage.grid.GridCoverage2D raster, int band)
     
    static double[]
    getSummaryStatsAll(org.geotools.coverage.grid.GridCoverage2D rasterGeom, int band, boolean excludeNoDataValue)
     
    static Double
    getZonalStats(org.geotools.coverage.grid.GridCoverage2D raster, org.locationtech.jts.geom.Geometry roi, int band, String statType)
     
    static Double
    getZonalStats(org.geotools.coverage.grid.GridCoverage2D raster, org.locationtech.jts.geom.Geometry roi, int band, String statType, boolean allTouched)
     
    static Double
    getZonalStats(org.geotools.coverage.grid.GridCoverage2D raster, org.locationtech.jts.geom.Geometry roi, int band, String statType, boolean allTouched, boolean excludeNoData)
     
    static Double
    getZonalStats(org.geotools.coverage.grid.GridCoverage2D raster, org.locationtech.jts.geom.Geometry roi, int band, String statType, boolean allTouched, boolean excludeNoData, boolean lenient)
     
    static Double
    getZonalStats(org.geotools.coverage.grid.GridCoverage2D raster, org.locationtech.jts.geom.Geometry roi, String statType)
     
    static Double[]
    getZonalStatsAll(org.geotools.coverage.grid.GridCoverage2D raster, org.locationtech.jts.geom.Geometry roi)
     
    static Double[]
    getZonalStatsAll(org.geotools.coverage.grid.GridCoverage2D raster, org.locationtech.jts.geom.Geometry roi, int band)
     
    static Double[]
    getZonalStatsAll(org.geotools.coverage.grid.GridCoverage2D raster, org.locationtech.jts.geom.Geometry roi, int band, boolean allTouched)
     
    static Double[]
    getZonalStatsAll(org.geotools.coverage.grid.GridCoverage2D raster, org.locationtech.jts.geom.Geometry roi, int band, boolean allTouched, boolean excludeNoData)
     
    static Double[]
    getZonalStatsAll(org.geotools.coverage.grid.GridCoverage2D raster, org.locationtech.jts.geom.Geometry roi, int band, boolean allTouched, boolean excludeNoData, boolean lenient)
     

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • RasterBandAccessors

      public RasterBandAccessors()
  • Method Details

    • getBandNoDataValue

      public static Double getBandNoDataValue(org.geotools.coverage.grid.GridCoverage2D raster, int band)
    • getBandNoDataValue

      public static Double getBandNoDataValue(org.geotools.coverage.grid.GridCoverage2D raster)
    • getCount

      public static long getCount(org.geotools.coverage.grid.GridCoverage2D raster, int band, boolean excludeNoDataValue)
    • getCount

      public static long getCount(org.geotools.coverage.grid.GridCoverage2D raster)
    • getCount

      public static long getCount(org.geotools.coverage.grid.GridCoverage2D raster, int band)
    • getZonalStatsAll

      public static Double[] getZonalStatsAll(org.geotools.coverage.grid.GridCoverage2D raster, org.locationtech.jts.geom.Geometry roi, int band, boolean allTouched, boolean excludeNoData, boolean lenient) throws org.geotools.api.referencing.FactoryException
      Parameters:
      raster - Raster to use for computing stats
      roi - Geometry to define the region of interest
      band - Band to be used for computation
      allTouched - Include pixels touched by roi geometry
      excludeNoData - Specifies whether to exclude no-data value or not
      lenient - Return null if the raster and roi do not intersect when set to true, otherwise will throw an exception
      Returns:
      An array with all the stats for the region
      Throws:
      org.geotools.api.referencing.FactoryException
    • getZonalStatsAll

      public static Double[] getZonalStatsAll(org.geotools.coverage.grid.GridCoverage2D raster, org.locationtech.jts.geom.Geometry roi, int band, boolean allTouched, boolean excludeNoData) throws org.geotools.api.referencing.FactoryException
      Parameters:
      raster - Raster to use for computing stats
      roi - Geometry to define the region of interest
      band - Band to be used for computation
      allTouched - Include pixels touched by roi geometry
      excludeNoData - Specifies whether to exclude no-data value or not
      Returns:
      An array with all the stats for the region
      Throws:
      org.geotools.api.referencing.FactoryException
    • getZonalStatsAll

      public static Double[] getZonalStatsAll(org.geotools.coverage.grid.GridCoverage2D raster, org.locationtech.jts.geom.Geometry roi, int band, boolean allTouched) throws org.geotools.api.referencing.FactoryException
      Parameters:
      raster - Raster to use for computing stats
      roi - Geometry to define the region of interest
      band - Band to be used for computation
      allTouched - Include pixels touched by roi geometry
      Returns:
      An array with all the stats for the region, excludeNoData is set to true
      Throws:
      org.geotools.api.referencing.FactoryException
    • getZonalStatsAll

      public static Double[] getZonalStatsAll(org.geotools.coverage.grid.GridCoverage2D raster, org.locationtech.jts.geom.Geometry roi, int band) throws org.geotools.api.referencing.FactoryException
      Parameters:
      raster - Raster to use for computing stats
      roi - Geometry to define the region of interest
      band - Band to be used for computation
      Returns:
      An array with all the stats for the region, excludeNoData is set to true
      Throws:
      org.geotools.api.referencing.FactoryException
    • getZonalStatsAll

      public static Double[] getZonalStatsAll(org.geotools.coverage.grid.GridCoverage2D raster, org.locationtech.jts.geom.Geometry roi) throws org.geotools.api.referencing.FactoryException
      Parameters:
      raster - Raster to use for computing stats
      roi - Geometry to define the region of interest
      Returns:
      An array with all the stats for the region, excludeNoData is set to true and band is set to 1
      Throws:
      org.geotools.api.referencing.FactoryException
    • getZonalStats

      public static Double getZonalStats(org.geotools.coverage.grid.GridCoverage2D raster, org.locationtech.jts.geom.Geometry roi, int band, String statType, boolean allTouched, boolean excludeNoData, boolean lenient) throws org.geotools.api.referencing.FactoryException
      Parameters:
      raster - Raster to use for computing stats
      roi - Geometry to define the region of interest
      band - Band to be used for computation
      statType - Define the statistic to be computed
      allTouched - Include pixels touched by roi geometry
      excludeNoData - Specifies whether to exclude no-data value or not
      lenient - Return null if the raster and roi do not intersect when set to true, otherwise will throw an exception
      Returns:
      A double precision floating point number representing the requested statistic calculated over the specified region.
      Throws:
      org.geotools.api.referencing.FactoryException
    • getZonalStats

      public static Double getZonalStats(org.geotools.coverage.grid.GridCoverage2D raster, org.locationtech.jts.geom.Geometry roi, int band, String statType, boolean allTouched, boolean excludeNoData) throws org.geotools.api.referencing.FactoryException
      Parameters:
      raster - Raster to use for computing stats
      roi - Geometry to define the region of interest
      band - Band to be used for computation
      statType - Define the statistic to be computed
      allTouched - Include pixels touched by roi geometry
      excludeNoData - Specifies whether to exclude no-data value or not
      Returns:
      A double precision floating point number representing the requested statistic calculated over the specified region.
      Throws:
      org.geotools.api.referencing.FactoryException
    • getZonalStats

      public static Double getZonalStats(org.geotools.coverage.grid.GridCoverage2D raster, org.locationtech.jts.geom.Geometry roi, int band, String statType, boolean allTouched) throws org.geotools.api.referencing.FactoryException
      Parameters:
      raster - Raster to use for computing stats
      roi - Geometry to define the region of interest
      band - Band to be used for computation
      statType - Define the statistic to be computed
      allTouched - Include pixels touched by roi geometry
      Returns:
      A double precision floating point number representing the requested statistic calculated over the specified region. The excludeNoData is set to true.
      Throws:
      org.geotools.api.referencing.FactoryException
    • getZonalStats

      public static Double getZonalStats(org.geotools.coverage.grid.GridCoverage2D raster, org.locationtech.jts.geom.Geometry roi, int band, String statType) throws org.geotools.api.referencing.FactoryException
      Parameters:
      raster - Raster to use for computing stats
      roi - Geometry to define the region of interest
      band - Band to be used for computation
      statType - Define the statistic to be computed
      Returns:
      A double precision floating point number representing the requested statistic calculated over the specified region. The excludeNoData is set to true.
      Throws:
      org.geotools.api.referencing.FactoryException
    • getZonalStats

      public static Double getZonalStats(org.geotools.coverage.grid.GridCoverage2D raster, org.locationtech.jts.geom.Geometry roi, String statType) throws org.geotools.api.referencing.FactoryException
      Parameters:
      raster - Raster to use for computing stats
      roi - Geometry to define the region of interest
      statType - Define the statistic to be computed
      Returns:
      A double precision floating point number representing the requested statistic calculated over the specified region. The excludeNoData is set to true and band is set to 1.
      Throws:
      org.geotools.api.referencing.FactoryException
    • getSummaryStats

      public static double getSummaryStats(org.geotools.coverage.grid.GridCoverage2D rasterGeom, String statType, int band, boolean excludeNoDataValue)
    • getSummaryStats

      public static double getSummaryStats(org.geotools.coverage.grid.GridCoverage2D rasterGeom, String statType, int band)
    • getSummaryStats

      public static double getSummaryStats(org.geotools.coverage.grid.GridCoverage2D rasterGeom, String statType)
    • getSummaryStatsAll

      public static double[] getSummaryStatsAll(org.geotools.coverage.grid.GridCoverage2D rasterGeom, int band, boolean excludeNoDataValue)
    • getSummaryStatsAll

      public static double[] getSummaryStatsAll(org.geotools.coverage.grid.GridCoverage2D raster, int band)
    • getSummaryStatsAll

      public static double[] getSummaryStatsAll(org.geotools.coverage.grid.GridCoverage2D raster)
    • getBand

      public static org.geotools.coverage.grid.GridCoverage2D getBand(org.geotools.coverage.grid.GridCoverage2D rasterGeom, int[] bandIndexes) throws org.geotools.api.referencing.FactoryException
      Parameters:
      rasterGeom - The raster where the bands will be extracted from.
      bandIndexes - The bands to be added to new raster.
      Returns:
      Raster with the specified bands.
      Throws:
      org.geotools.api.referencing.FactoryException
    • getBandType

      public static String getBandType(org.geotools.coverage.grid.GridCoverage2D raster, int band)
    • getBandType

      public static String getBandType(org.geotools.coverage.grid.GridCoverage2D raster)
    • bandIsNoData

      public static boolean bandIsNoData(org.geotools.coverage.grid.GridCoverage2D raster, int band)
      Returns true if the band is filled with only nodata values.
      Parameters:
      raster - The raster to check
      band - The 1-based index of band to check
      Returns:
      true if the band is filled with only nodata values, false otherwise
    • bandIsNoData

      public static boolean bandIsNoData(org.geotools.coverage.grid.GridCoverage2D raster)