Class IntersectUtils

Object
IntersectUtils

public class IntersectUtils extends Object
Performs some naive intersections on GeometryCollections, because JTS is not supporting them.
Author:
Emanuele Tajariol (GeoSolutions)
  • Constructor Details

    • IntersectUtils

      public IntersectUtils()
  • Method Details

    • intersects

      public static boolean intersects(Geometry g1, Geometry g2)
      Tests whether the two geometries intersect.

      This method relies completely on Geometry.intersects(Geometry) but also tries to unroll GeometryCollections.

      Returns:
      true if the two geometries intersect.
    • intersection

      public static Geometry intersection(Geometry g1, Geometry g2)
      Return the intersection of two Geometries.
      This method relies completely on Geometry.intersection(Geometry) but also tries to unroll GeometryCollections.
      Returns:
      true if the two geometries intersect.
    • unrollGeometries

      public static Geometry unrollGeometries(Geometry geometry) throws IllegalArgumentException
      Flatten all first-level (i.e. non recursively) bundles (GeometryCollections and MultiPolygons) into a GeometryCollection.
      Valid structures:
      • null -> null
      • Polygon -> Polygon
      • MultiPolygon -> GeometryCollection of Polygons
      • GeometryCollection holding Polygons and MultiPolygons -> GeometryCollection of Polygons
      Throws:
      IllegalArgumentException - when encountering illegal Geometries; message is the Geometry class name.