Class GriddedGeometry

java.lang.Object
nz.org.riskscape.engine.geo.GriddedGeometry

public class GriddedGeometry extends Object

Can apply a GridGeometry to a Geometry to be able to slice it up in to cells

  • Field Details

  • Constructor Details

    • GriddedGeometry

      public GriddedGeometry(org.locationtech.jts.geom.Geometry feature, org.geotools.coverage.grid.GridGeometry2D gridGeometry) throws org.geotools.api.geometry.MismatchedDimensionException, org.geotools.api.referencing.operation.TransformException

      Construct a new GriddedGeometry that applies a GridGeometry2D to a Geometry object. No re-projection is done by this class, it is up to the caller to ensure that the CoordinateReferenceSystem of the gridGeometry's world matches the CoordinateReferenceSystem of the feature.

      Throws:
      org.geotools.api.geometry.MismatchedDimensionException
      org.geotools.api.referencing.operation.TransformException
  • Method Details

    • getGridEnvelopeInWorldCRS

      public org.locationtech.jts.geom.Envelope getGridEnvelopeInWorldCRS()
      Returns:
      an Envelope based on convering the grid's dimensions to the world's - note that this will not add the extra pixel on to width and height that the geometry does - this method is really here for tests and sanity checking
    • getCellIterator

      public Iterator<org.locationtech.jts.geom.Geometry> getCellIterator()
      Returns:
      an Iterator that lazily yields intersecting geometries from the grid being laid over the geometry
    • getCellIterator

      public Iterator<org.locationtech.jts.geom.Geometry> getCellIterator(EnumSet<GriddedGeometry.Options> options, Predicate<org.locationtech.jts.geom.Polygon> filter)

      Creates a customized Iterator over the gridded geometry.

      Parameters:
      options - Creates the iterator with the given GriddedGeometry.Options. In general, using the {@link #DEFAULT<em>OPTIONS}, in particular MATCHSOURCE_GEOMETRY, is highly recommended.
      filter - given the polygon of the cell pixel, this returns whether the intersecting geometry should be computed and returned. This up-front test can avoid doing the expensive geometry intersection operation unnecessarily
      Returns:
      an Iterator that lazily yields intersecting geometries from the grid being laid over the geometry
    • getFeature

      public org.locationtech.jts.geom.Geometry getFeature()
    • getGridGeometry

      public org.geotools.coverage.grid.GridGeometry2D getGridGeometry()
    • getGridEnvelope

      public org.locationtech.jts.geom.Envelope getGridEnvelope()
    • getGridToCRS

      public org.geotools.api.referencing.operation.MathTransform getGridToCRS()