Class JtsSpatialContext
- java.lang.Object
-
- org.locationtech.spatial4j.context.SpatialContext
-
- org.locationtech.spatial4j.context.jts.JtsSpatialContext
-
public class JtsSpatialContext extends SpatialContext
Enhances the defaultSpatialContext
with support for Polygons (and other geometries) using JTS. To the extent possible, ourJtsGeometry
adds 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 JtsSpatialContext
GEO
-
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 DatelineRule
getDatelineRule()
Deprecated.org.locationtech.jts.geom.GeometryFactory
getGeometryFactory()
Deprecated.org.locationtech.jts.geom.Geometry
getGeometryFrom(Shape shape)
Deprecated.JtsShapeFactory
getShapeFactory()
A factory forShape
s.ValidationRule
getValidationRule()
Deprecated.boolean
isAllowMultiOverlap()
Deprecated.boolean
isAutoIndex()
Deprecated.Rectangle
makeRectFromRectangularPoly(org.locationtech.jts.geom.Geometry geom)
Deprecated.JtsGeometry
makeShape(org.locationtech.jts.geom.Geometry geom)
Deprecated.JtsGeometry
makeShape(org.locationtech.jts.geom.Geometry geom, boolean dateline180Check, boolean allowMultiOverlap)
Deprecated.Shape
makeShapeFromGeometry(org.locationtech.jts.geom.Geometry geom)
Deprecated.java.lang.String
toString()
boolean
useJtsLineString()
Deprecated.boolean
useJtsPoint()
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:SpatialContext
A factory forShape
s.- Overrides:
getShapeFactory
in 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 theShapeReader
s.
-
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 org.locationtech.jts.geom.Geometry getGeometryFrom(Shape shape)
Deprecated.Gets a JTSGeometry
for 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(org.locationtech.jts.geom.Geometry geom)
Deprecated.INTERNAL Usually creates a JtsGeometry, potentially validating, repairing, and indexing ("preparing"). This method is intended for use byShapeReader
instances. If given a direct instance ofGeometryCollection
then it's contents will be recursively converted and then the resulting list will be passed toSpatialContext.makeCollection(List)
and returned. If given aPoint
thenSpatialContext.makePoint(double, double)
is called, which will return aJtsPoint
ifuseJtsPoint()
; otherwise a standard Spatial4j Point is returned. If given aLineString
and ifuseJtsLineString()
is true then then the geometry's parts are exposed to callSpatialContext.makeLineString(List)
.
-
makeShape
@Deprecated public JtsGeometry makeShape(org.locationtech.jts.geom.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(org.locationtech.jts.geom.Geometry geom)
Deprecated.INTERNAL: Creates aShape
from 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 ofGeometryCollection
isn't supported. Instead of calling this method, considerJtsShapeFactory.makeShapeFromGeometry(Geometry)
which
-
getGeometryFactory
@Deprecated public org.locationtech.jts.geom.GeometryFactory getGeometryFactory()
Deprecated.
-
toString
public java.lang.String toString()
- Overrides:
toString
in classSpatialContext
-
makeRectFromRectangularPoly
@Deprecated public Rectangle makeRectFromRectangularPoly(org.locationtech.jts.geom.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 theDatelineRule
setting.- Parameters:
geom
- non-null- Returns:
- null equivalent Rectangle.
-
-