Class JtsSpatialContext
java.lang.Object
org.locationtech.spatial4j.context.SpatialContext
org.locationtech.spatial4j.context.jts.JtsSpatialContext
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 Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionDeprecated.org.locationtech.jts.geom.GeometryFactory
Deprecated.org.locationtech.jts.geom.Geometry
getGeometryFrom
(Shape shape) Deprecated.A factory forShape
s.Deprecated.boolean
Deprecated.boolean
Deprecated.makeRectFromRectangularPoly
(org.locationtech.jts.geom.Geometry geom) Deprecated.makeShape
(org.locationtech.jts.geom.Geometry geom) Deprecated.makeShape
(org.locationtech.jts.geom.Geometry geom, boolean dateline180Check, boolean allowMultiOverlap) Deprecated.makeShapeFromGeometry
(org.locationtech.jts.geom.Geometry geom) Deprecated.toString()
boolean
Deprecated.boolean
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 Details
-
GEO
-
-
Constructor Details
-
JtsSpatialContext
Called byJtsSpatialContextFactory.newSpatialContext()
.
-
-
Method Details
-
getShapeFactory
Description copied from class:SpatialContext
A factory forShape
s.- Overrides:
getShapeFactory
in classSpatialContext
-
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.Returns the rule used to handle geometry objects that have dateline (aka anti-meridian) crossing considerations. -
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.If JtsGeometry shapes should be automatically "prepared" (i.e. optimized) when read via from aShapeReader
.- See Also:
-
getGeometryFrom
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.ShouldSpatialContext.makePoint(double, double)
returnJtsPoint
? -
useJtsLineString
Deprecated.ShouldSpatialContext.makeLineString(java.util.List)
returnJtsGeometry
? -
makeShapeFromGeometry
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
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. -
toString
- Overrides:
toString
in classSpatialContext
-
makeRectFromRectangularPoly
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.
-