Class JtsSpatialContext
- java.lang.Object
-
- org.locationtech.spatial4j.context.SpatialContext
-
- org.locationtech.spatial4j.context.jts.JtsSpatialContext
-
public class JtsSpatialContext extends SpatialContext
Enhances the defaultSpatialContextwith support for Polygons (and other geometries) using JTS. To the extent possible, ourJtsGeometryadds some amount of geodetic support over vanilla JTS which only has a Euclidean (flat plane) model.
-
-
Field Summary
Fields Modifier and Type Field Description static JtsSpatialContextGEO
-
Constructor Summary
Constructors Constructor Description JtsSpatialContext(JtsSpatialContextFactory factory)Called byJtsSpatialContextFactory.newSpatialContext().
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description DatelineRulegetDatelineRule()Deprecated.GeometryFactorygetGeometryFactory()Deprecated.GeometrygetGeometryFrom(Shape shape)Deprecated.JtsShapeFactorygetShapeFactory()A factory forShapes.ValidationRulegetValidationRule()Deprecated.booleanisAllowMultiOverlap()Deprecated.booleanisAutoIndex()Deprecated.RectanglemakeRectFromRectangularPoly(Geometry geom)Deprecated.JtsGeometrymakeShape(Geometry geom)Deprecated.JtsGeometrymakeShape(Geometry geom, boolean dateline180Check, boolean allowMultiOverlap)Deprecated.ShapemakeShapeFromGeometry(Geometry geom)Deprecated.StringtoString()booleanuseJtsLineString()Deprecated.booleanuseJtsPoint()Deprecated.-
Methods inherited from class org.locationtech.spatial4j.context.SpatialContext
calcDistance, calcDistance, getBinaryCodec, getDistCalc, getFormats, getWktShapeParser, getWorldBounds, isGeo, isNormWrapLongitude, makeBufferedLineString, makeCircle, makeCircle, makeCollection, makeLineString, makePoint, makeRectangle, makeRectangle, normX, normY, readShape, readShapeFromWkt, toString, verifyX, verifyY
-
-
-
-
Field Detail
-
GEO
public static final JtsSpatialContext GEO
-
-
Constructor Detail
-
JtsSpatialContext
public JtsSpatialContext(JtsSpatialContextFactory factory)
Called byJtsSpatialContextFactory.newSpatialContext().
-
-
Method Detail
-
getShapeFactory
public JtsShapeFactory getShapeFactory()
Description copied from class:SpatialContextA factory forShapes.- Overrides:
getShapeFactoryin classSpatialContext
-
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 thisShapeCollection.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 JTSGeometry, particularly after it has been read from one of theShapeReaders.
-
isAutoIndex
@Deprecated public boolean isAutoIndex()
Deprecated.If JtsGeometry shapes should be automatically "prepared" (i.e. optimized) when read via from aShapeReader.- See Also:
JtsGeometry.index()
-
getGeometryFrom
@Deprecated public Geometry getGeometryFrom(Shape shape)
Deprecated.Gets a JTSGeometryfor the givenShape. 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.ShouldSpatialContext.makePoint(double, double)returnJtsPoint?
-
useJtsLineString
@Deprecated public boolean useJtsLineString()
Deprecated.ShouldSpatialContext.makeLineString(java.util.List)returnJtsGeometry?
-
makeShapeFromGeometry
@Deprecated public Shape makeShapeFromGeometry(Geometry geom)
Deprecated.INTERNAL Usually creates a JtsGeometry, potentially validating, repairing, and indexing ("preparing"). This method is intended for use byShapeReaderinstances. If given a direct instance ofGeometryCollectionthen it's contents will be recursively converted and then the resulting list will be passed toSpatialContext.makeCollection(List)and returned. If given aPointthenSpatialContext.makePoint(double, double)is called, which will return aJtsPointifuseJtsPoint(); otherwise a standard Spatial4j Point is returned. If given aLineStringand ifuseJtsLineString()is true then then the geometry's parts are exposed to callSpatialContext.makeLineString(List).
-
makeShape
@Deprecated public JtsGeometry makeShape(Geometry geom, boolean dateline180Check, boolean allowMultiOverlap)
Deprecated.INTERNAL- Parameters:
geom- Non-nulldateline180Check- if both this is true andSpatialContext.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- SeeisAllowMultiOverlap().- See Also:
makeShape(org.locationtech.jts.geom.Geometry)
-
makeShape
@Deprecated public JtsGeometry makeShape(Geometry geom)
Deprecated.INTERNAL: Creates aShapefrom a JTSGeometry. 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 ofGeometryCollectionisn't supported. Instead of calling this method, considerJtsShapeFactory.makeShapeFromGeometry(Geometry)which
-
getGeometryFactory
@Deprecated public GeometryFactory getGeometryFactory()
Deprecated.
-
toString
public String toString()
- Overrides:
toStringin classSpatialContext
-
makeRectFromRectangularPoly
@Deprecated public Rectangle makeRectFromRectangularPoly(Geometry geom)
Deprecated.INTERNAL: Returns a Rectangle of the JTSEnvelope(bounding box) of the givengeom. This asserts thatGeometry.isRectangle()is true. This method reacts to theDatelineRulesetting.- Parameters:
geom- non-null- Returns:
- null equivalent Rectangle.
-
-