Package org.apache.sedona.common.utils
Class GeometrySplitter
java.lang.Object
org.apache.sedona.common.utils.GeometrySplitter
Class to split geometry by other geometry.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionorg.locationtech.jts.geom.GeometryCollectionsplit(org.locationtech.jts.geom.Geometry input, org.locationtech.jts.geom.Geometry blade) Split input geometry by the blade geometry.org.locationtech.jts.geom.MultiLineStringsplitLines(org.locationtech.jts.geom.Geometry input, org.locationtech.jts.geom.Geometry blade) Split linear input geometry by the blade geometry.org.locationtech.jts.geom.MultiPolygonsplitPolygons(org.locationtech.jts.geom.Geometry input, org.locationtech.jts.geom.Geometry blade) Split polygonal input geometry by the blade geometry.
-
Constructor Details
-
GeometrySplitter
public GeometrySplitter(org.locationtech.jts.geom.GeometryFactory geometryFactory)
-
-
Method Details
-
split
public org.locationtech.jts.geom.GeometryCollection split(org.locationtech.jts.geom.Geometry input, org.locationtech.jts.geom.Geometry blade) Split input geometry by the blade geometry. Input geometry can be lineal (LineString or MultiLineString) or polygonal (Polygon or MultiPolygon). A GeometryCollection can also be used as an input, but it must be homogeneous. For lineal geometry refer to thesplitLinesmethod for restrictions on the blade. Refer tosplitPolygonsfor restrictions on the blade for polygonal input geometry.The result will be null if the input geometry and blade are either invalid in general or in relation to each other. Otherwise, the result will always be a MultiLineString or MultiPolygon depending on the input, and even if the result is a single geometry.
- Parameters:
input- input geometryblade- geometry to use as a blade- Returns:
- multi-geometry resulting from the split or null if invalid
-
splitLines
public org.locationtech.jts.geom.MultiLineString splitLines(org.locationtech.jts.geom.Geometry input, org.locationtech.jts.geom.Geometry blade) Split linear input geometry by the blade geometry. Input geometry is assumed to be either a LineString, MultiLineString, or a homogeneous collection of lines in a GeometryCollection. The blade geometry can be any individual puntal, lineal, or polygonal geometry or homogeneous collection of those geometries. Blades that are polygonal will use their boundary for the split. Will always return a MultiLineString.- Parameters:
input- input geometry to be split that must be linealblade- blade geometry to use for split- Returns:
- input geometry split by blade
-
splitPolygons
public org.locationtech.jts.geom.MultiPolygon splitPolygons(org.locationtech.jts.geom.Geometry input, org.locationtech.jts.geom.Geometry blade) Split polygonal input geometry by the blade geometry. Input geometry is assumed to be either a Polygon, MultiPolygon, or a GeometryCollection of only polygons. The blade geometry can be any individual lineal or polygonal geometry or homogeneous collection of those geometries. Blades that are polygonal will use their boundary for the split. Will always return a MultiPolygon.- Parameters:
input- input polygonal geometry to splitblade- geometry to split the input by- Returns:
- input geometry split by the blade
-