Class RelateNG
java.lang.Object
org.locationtech.jts.operation.relateng.RelateNG
Computes the value of topological predicates between two geometries based on the
Dimensionally-Extended 9-Intersection Model (DE-9IM).
Standard and custom topological predicates are provided by
RelatePredicate.
The RelateNG algorithm has the following capabilities:
- Efficient short-circuited evaluation of topological predicates (including matching custom DE-9IM matrix patterns)
- Optimized repeated evaluation of predicates against a single geometry via cached spatial indexes (AKA "prepared mode")
- Robust computation (only point-local topology is required, so invalid geometry topology does not cause failures)
-
inputs containing mixed types and overlapping polygons are supported, using union semantics.
invalid reference
GeometryCollection - Zero-length LineStrings are treated as being topologically identical to Points.
- Support for
BoundaryNodeRules.
IntersectionMatrixPattern for a description of DE-9IM patterns.
If not specified, the standard BoundaryNodeRule.MOD2_BOUNDARY_RULE is used.
RelateNG operates in 2D only; it ignores any Z ordinates.
This implementation replaces RelateOp and PreparedGeometry.
FUTURE WORK
- Support for a distance tolerance to provide "approximate" predicate evaluation
- Author:
- Martin Davis
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionComputes the DE-9IM matrix for the topological relationship to a geometry.booleanTests whether the topological relationship to a geometry matches a DE-9IM matrix pattern.booleanevaluate(Geometry b, TopologyPredicate predicate) Tests whether the topological relationship to a geometry satisfies a topology predicate.static RelateNGCreates a prepared RelateNG instance to optimize the evaluation of relationships against a single geometry.static RelateNGprepare(Geometry a, BoundaryNodeRule bnRule) Creates a prepared RelateNG instance to optimize the computation of predicates against a single geometry, using a givenBoundaryNodeRule.static IntersectionMatrixComputes the DE-9IM matrix for the topological relationship between two geometries.static booleanTests whether the topological relationship to a geometry matches a DE-9IM matrix pattern.static IntersectionMatrixrelate(Geometry a, Geometry b, BoundaryNodeRule bnRule) Computes the DE-9IM matrix for the topological relationship between two geometries.static booleanrelate(Geometry a, Geometry b, TopologyPredicate pred) Tests whether the topological relationship between two geometries satisfies a topological predicate.static booleanrelate(Geometry a, Geometry b, TopologyPredicate pred, BoundaryNodeRule bnRule) Tests whether the topological relationship between two geometries satisfies a topological predicate, using a givenBoundaryNodeRule.
-
Method Details
-
relate
Tests whether the topological relationship between two geometries satisfies a topological predicate.- Parameters:
a- the A input geometryb- the A input geometrypred- the topological predicate- Returns:
- true if the topological relationship is satisfied
-
relate
public static boolean relate(Geometry a, Geometry b, TopologyPredicate pred, BoundaryNodeRule bnRule) Tests whether the topological relationship between two geometries satisfies a topological predicate, using a givenBoundaryNodeRule.- Parameters:
a- the A input geometryb- the A input geometrypred- the topological predicatebnRule- the Boundary Node Rule to use- Returns:
- true if the topological relationship is satisfied
-
relate
Tests whether the topological relationship to a geometry matches a DE-9IM matrix pattern.- Parameters:
a- the A input geometryb- the A input geometryimPattern- the DE-9IM pattern to match- Returns:
- true if the geometries relationship matches the DE-9IM pattern
- See Also:
-
relate
Computes the DE-9IM matrix for the topological relationship between two geometries.- Parameters:
a- the A input geometryb- the A input geometry- Returns:
- the DE-9IM matrix for the topological relationship
-
relate
Computes the DE-9IM matrix for the topological relationship between two geometries.- Parameters:
a- the A input geometryb- the A input geometrybnRule- the Boundary Node Rule to use- Returns:
- the DE-9IM matrix for the relationship
-
prepare
-
prepare
Creates a prepared RelateNG instance to optimize the computation of predicates against a single geometry, using a givenBoundaryNodeRule.- Parameters:
a- the A input geometrybnRule- the required BoundaryNodeRule- Returns:
- a prepared instance
-
evaluate
Computes the DE-9IM matrix for the topological relationship to a geometry.- Parameters:
b- the B geometry to test against- Returns:
- the DE-9IM matrix
-
evaluate
Tests whether the topological relationship to a geometry matches a DE-9IM matrix pattern.- Parameters:
b- the B geometry to test againstimPattern- the DE-9IM pattern to match- Returns:
- true if the geometries' topological relationship matches the DE-9IM pattern
- See Also:
-
evaluate
Tests whether the topological relationship to a geometry satisfies a topology predicate.- Parameters:
b- the B geometry to test againstpredicate- the topological predicate- Returns:
- true if the predicate is satisfied
-