Class GeometrySplitter

java.lang.Object
org.apache.sedona.common.utils.GeometrySplitter

public final class GeometrySplitter extends Object
Class to split geometry by other geometry.
  • Constructor Summary

    Constructors
    Constructor
    Description
    GeometrySplitter(org.locationtech.jts.geom.GeometryFactory geometryFactory)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    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.
    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.
    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.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • 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 the splitLines method for restrictions on the blade. Refer to splitPolygons for 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 geometry
      blade - 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 lineal
      blade - 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 split
      blade - geometry to split the input by
      Returns:
      input geometry split by the blade