Package nz.org.riskscape.engine.geo
Class GriddedGeometry
java.lang.Object
nz.org.riskscape.engine.geo.GriddedGeometry
Can apply a GridGeometry
to a Geometry
to be able to slice it up in to cells
-
Nested Class Summary
-
Field Summary
Modifier and TypeFieldDescriptionstatic final EnumSet<GriddedGeometry.Options>
static final Predicate<org.locationtech.jts.geom.Polygon>
-
Constructor Summary
ConstructorDescriptionGriddedGeometry
(org.locationtech.jts.geom.Geometry feature, org.geotools.coverage.grid.GridGeometry2D gridGeometry) -
Method Summary
Modifier and TypeMethodDescriptionIterator<org.locationtech.jts.geom.Geometry>
Iterator<org.locationtech.jts.geom.Geometry>
getCellIterator
(EnumSet<GriddedGeometry.Options> options, Predicate<org.locationtech.jts.geom.Polygon> filter) Creates a customizedIterator
over the gridded geometry.org.locationtech.jts.geom.Geometry
org.locationtech.jts.geom.Envelope
org.locationtech.jts.geom.Envelope
org.geotools.coverage.grid.GridGeometry2D
org.geotools.api.referencing.operation.MathTransform
-
Field Details
-
DEFAULT_OPTIONS
-
INCLUDE_ALL_CELLS
-
-
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 aGridGeometry2D
to aGeometry
object. No re-projection is done by this class, it is up to the caller to ensure that theCoordinateReferenceSystem
of the gridGeometry'sworld
matches theCoordinateReferenceSystem
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
- 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 givenGriddedGeometry.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()
-