Class JtsSpatialContext

java.lang.Object
org.locationtech.spatial4j.context.SpatialContext
org.locationtech.spatial4j.context.jts.JtsSpatialContext

public class JtsSpatialContext extends SpatialContext
Enhances the default SpatialContext with support for Polygons (and other geometries) using JTS. To the extent possible, our JtsGeometry adds some amount of geodetic support over vanilla JTS which only has a Euclidean (flat plane) model.
  • Field Details

  • Constructor Details

  • Method Details

    • getShapeFactory

      public JtsShapeFactory getShapeFactory()
      Description copied from class: SpatialContext
      A factory for Shapes.
      Overrides:
      getShapeFactory in class SpatialContext
    • isAllowMultiOverlap

      @Deprecated public boolean isAllowMultiOverlap()
      Deprecated.
      If geom might be a multi geometry of some kind, then might multiple component geometries overlap? Strict OGC says this is invalid but we can accept it by computing the union. Note: Our ShapeCollection mostly doesn't care but it has a method related to this ShapeCollection.relateContainsShortCircuits().
    • getDatelineRule

      @Deprecated public DatelineRule getDatelineRule()
      Deprecated.
      Returns the rule used to handle geometry objects that have dateline (aka anti-meridian) crossing considerations.
    • getValidationRule

      @Deprecated public ValidationRule getValidationRule()
      Deprecated.
      Returns the rule used to handle errors when creating a JTS Geometry, particularly after it has been read from one of the ShapeReaders.
    • isAutoIndex

      @Deprecated public boolean isAutoIndex()
      Deprecated.
      If JtsGeometry shapes should be automatically "prepared" (i.e. optimized) when read via from a ShapeReader.
      See Also:
    • getGeometryFrom

      @Deprecated public org.locationtech.jts.geom.Geometry getGeometryFrom(Shape shape)
      Deprecated.
      Gets a JTS Geometry for the given Shape. Some shapes hold a JTS geometry whereas new ones must be created for the rest.
      Parameters:
      shape - Not null
      Returns:
      Not null
    • useJtsPoint

      @Deprecated public boolean useJtsPoint()
      Deprecated.
    • useJtsLineString

      @Deprecated public boolean useJtsLineString()
      Deprecated.
    • makeShapeFromGeometry

      @Deprecated public Shape makeShapeFromGeometry(org.locationtech.jts.geom.Geometry geom)
      Deprecated.
      INTERNAL Usually creates a JtsGeometry, potentially validating, repairing, and indexing ("preparing"). This method is intended for use by ShapeReader instances. If given a direct instance of GeometryCollection then it's contents will be recursively converted and then the resulting list will be passed to SpatialContext.makeCollection(List) and returned. If given a Point then SpatialContext.makePoint(double, double) is called, which will return a JtsPoint if useJtsPoint(); otherwise a standard Spatial4j Point is returned. If given a LineString and if useJtsLineString() is true then then the geometry's parts are exposed to call SpatialContext.makeLineString(List).
    • makeShape

      @Deprecated public JtsGeometry makeShape(org.locationtech.jts.geom.Geometry geom, boolean dateline180Check, boolean allowMultiOverlap)
      Deprecated.
      INTERNAL
      Parameters:
      geom - Non-null
      dateline180Check - if both this is true and SpatialContext.isGeo(), then JtsGeometry will check for adjacent coordinates greater than 180 degrees longitude apart, and it will do tricks to make that line segment (and the shape as a whole) cross the dateline even though JTS doesn't have geodetic support.
      allowMultiOverlap - See isAllowMultiOverlap().
      See Also:
    • makeShape

      @Deprecated public JtsGeometry makeShape(org.locationtech.jts.geom.Geometry geom)
      Deprecated.
      INTERNAL: Creates a Shape from a JTS Geometry. Generally, this shouldn't be called when one of the other factory methods are available, such as for points. The caller needs to have done some verification/normalization of the coordinates by now, if any. Also, note that direct instances of GeometryCollection isn't supported. Instead of calling this method, consider JtsShapeFactory.makeShapeFromGeometry(Geometry) which
    • getGeometryFactory

      @Deprecated public org.locationtech.jts.geom.GeometryFactory getGeometryFactory()
      Deprecated.
    • toString

      public String toString()
      Overrides:
      toString in class SpatialContext
    • makeRectFromRectangularPoly

      @Deprecated public Rectangle makeRectFromRectangularPoly(org.locationtech.jts.geom.Geometry geom)
      Deprecated.
      INTERNAL: Returns a Rectangle of the JTS Envelope (bounding box) of the given geom. This asserts that Geometry.isRectangle() is true. This method reacts to the DatelineRule setting.
      Parameters:
      geom - non-null
      Returns:
      null equivalent Rectangle.