Class SparseTiffCoverage

java.lang.Object
javax.media.jai.PropertySourceImpl
org.geotools.coverage.AbstractCoverage
org.geotools.coverage.grid.AbstractGridCoverage
org.geotools.coverage.grid.GridCoverage2D
nz.org.riskscape.engine.tiff.SparseTiffCoverage
All Implemented Interfaces:
Serializable, javax.media.jai.PropertySource, org.geotools.api.coverage.Coverage, org.geotools.api.coverage.grid.GridCoverage

public class SparseTiffCoverage extends org.geotools.coverage.grid.GridCoverage2D

Extends GridCoverage2D to make use of SparseTIFFImageReader.isEmptyTile(int, int). Using this method allows us to avoid bringing empty tiles in to JAI's tile cache, which uses RAM and processing time. Instead we can short circuit the usual pixel lookup and return NO_DATA when an empty tile is queried.

See Also:
  • Nested Class Summary

    Nested classes/interfaces inherited from class org.geotools.coverage.grid.GridCoverage2D

    org.geotools.coverage.grid.GridCoverage2D.Renderable
  • Field Summary

    Fields inherited from class org.geotools.coverage.grid.GridCoverage2D

    gridGeometry, image

    Fields inherited from class org.geotools.coverage.grid.AbstractGridCoverage

    LOGGER

    Fields inherited from class org.geotools.coverage.AbstractCoverage

    crs

    Fields inherited from class javax.media.jai.PropertySourceImpl

    cachedPropertyNames, properties, propertySources
  • Constructor Summary

    Constructors
    Constructor
    Description
    SparseTiffCoverage(CharSequence name, org.geotools.coverage.grid.GridCoverage2D coverage)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static org.geotools.api.coverage.grid.GridCoverage
    createIfSupported(org.geotools.api.coverage.grid.GridCoverage coverage, File file)
     
    double[]
    evaluate(org.geotools.api.geometry.Position coord, double[] dest)
    Overrides the evaluate method we use from GridCoverage2D to do the isEmptyTile short circuit.
    double[]
    evaluate(org.geotools.coverage.grid.GridCoordinates2D coord, double[] dest)
    Overrides the evaluate method for GridCoordinates2D to do the isEmptyTile short circuit.
    double[]
     

    Methods inherited from class org.geotools.coverage.grid.GridCoverage2D

    dispose, evaluate, evaluate, evaluate, evaluate, evaluate, evaluate, evaluate, evaluate, evaluate, getCoordinateReferenceSystem2D, getDebugString, getEnvelope, getEnvelope2D, getGridGeometry, getInterpolation, getNumSampleDimensions, getOptimalDataBlockSizes, getRenderableImage, getRenderedImage, getSampleDimension, getSampleDimensions, isDataEditable, prefetch, show, show, toString

    Methods inherited from class org.geotools.coverage.grid.AbstractGridCoverage

    formatEvaluateError, formatEvaluateError, getNumOverviews, getOverview, getOverviewGridGeometry, getSources

    Methods inherited from class org.geotools.coverage.AbstractCoverage

    evaluate, evaluate, getCoordinateReferenceSystem, getDimension, getLocale, getName, getRangeType, show

    Methods inherited from class javax.media.jai.PropertySourceImpl

    getProperties, getProperty, getPropertyClass, getPropertyNames, getPropertyNames

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait

    Methods inherited from interface org.geotools.api.coverage.Coverage

    evaluate, evaluate, getCoordinateReferenceSystem, getRangeType
  • Constructor Details

    • SparseTiffCoverage

      public SparseTiffCoverage(CharSequence name, org.geotools.coverage.grid.GridCoverage2D coverage)
  • Method Details

    • createIfSupported

      public static org.geotools.api.coverage.grid.GridCoverage createIfSupported(org.geotools.api.coverage.grid.GridCoverage coverage, File file)
    • evaluate

      public double[] evaluate(org.geotools.api.geometry.Position coord, double[] dest)

      Overrides the evaluate method we use from GridCoverage2D to do the isEmptyTile short circuit.

      Important - this method returns noData instead of throwing a PointOutsideCoverageException if the point is out of bounds. Throwing an exception is expensive and we always swallow these exceptions and turn them in to no-data anyway.

      Specified by:
      evaluate in interface org.geotools.api.coverage.Coverage
      Overrides:
      evaluate in class org.geotools.coverage.grid.GridCoverage2D
    • evaluate

      public double[] evaluate(org.geotools.coverage.grid.GridCoordinates2D coord, double[] dest)

      Overrides the evaluate method for GridCoordinates2D to do the isEmptyTile short circuit. This method is used by GridTypedCoverage and SparseTIFFImageReader.

      Important - this method returns noData instead of throwing a PointOutsideCoverageException if the point is out of bounds. Throwing an exception is expensive and we always swallow these exceptions and turn them in to no-data anyway.

      Overrides:
      evaluate in class org.geotools.coverage.grid.GridCoverage2D
    • getNoData

      public double[] getNoData()