Class RelatePredicate
Creates predicate instances for evaluating OGC-standard named topological relationships. Predicates can be evaluated for geometries using RelateNG.
Inherited Members
Namespace: NetTopologySuite.Operation.RelateNG
Assembly: NetTopologySuite.dll
Syntax
public static class RelatePredicate
Methods
| Edit this page View SourceContains()
Creates a predicate to determine whether a geometry contains another geometry.
TheContains predicate has the following equivalent definitions:
- Every point of the other geometry is a point of this geometry, and the interiors of the two geometries have at least one point in common.
- The DE-9IM Intersection Matrix for the two geometries matches
the pattern
[T*****FF*] within(B, A) = true
(containsis the converse of Within())
B.contains(A) = false.
(As a concrete example, take A to be a LineString which lies in the boundary of a Polygon B.)
For a predicate with similar behavior but avoiding
this subtle limitation, see Covers().
Declaration
public static TopologyPredicate Contains()
Returns
| Type | Description |
|---|---|
| TopologyPredicate | The predicate instance |
See Also
| Edit this page View SourceCoveredBy()
Creates a predicate to determine whether a geometry is covered by another geometry.
TheCoveredBy predicate has the following equivalent definitions:
- Every point of this geometry is a point of the other geometry.
- The DE-9IM Intersection Matrix for the two geometries matches
at least one of the following patterns:
[T*F**F***][*TF**F***][**FT*F***][**F*TF***]
Covers(B, A) = true
(CoveredByis the converse of Covers())
false.
This predicate is similar to {@link #within},
but is more inclusive (i.e. returns true for more cases).
Declaration
public static TopologyPredicate CoveredBy()
Returns
| Type | Description |
|---|---|
| TopologyPredicate | The predicate instance |
See Also
| Edit this page View SourceCovers()
Creates a predicate to determine whether a geometry covers another geometry.
TheCovers predicate has the following equivalent definitions:
- Every point of the other geometry is a point of this geometry.
- The DE-9IM Intersection Matrix for the two geometries matches
at least one of the following patterns:
[T*****FF*][*T****FF*][***T**FF*][****T*FF*]
CoveredBy(b, a) = true
(Coversis the converse of CoveredBy())
false.
This predicate is similar to Contains(),
but is more inclusive (i.e. returns true for more cases).
In particular, unlike Contains it does not distinguish between
points in the boundary and in the interior of geometries.
For most cases, Covers should be used in preference to Contains.
As an added benefit, Covers is more amenable to optimization,
and hence should be more performant.
Declaration
public static TopologyPredicate Covers()
Returns
| Type | Description |
|---|---|
| TopologyPredicate | The predicate instance |
See Also
| Edit this page View SourceCrosses()
Creates a predicate to determine whether a geometry crosses another geometry.
TheCrosses predicate has the following equivalent definitions:
- The geometries have some but not all interior points in common.
- The DE-9IM Intersection Matrix for the two geometries matches
one of the following patterns:
[TT*****](for P/L, P/A, and L/A cases)[TT](for L/P, A/P, and A/L cases)[0*****](for L/L cases)
false.
The SFS defined this predicate only for P/L, P/A, L/L, and L/A cases.
To make the relation symmetric
NTS extends the definition to apply to L/P, A/P and A/L cases as well.
Declaration
public static TopologyPredicate Crosses()
Returns
| Type | Description |
|---|---|
| TopologyPredicate | The crosses predicate |
Disjoint()
Creates a predicate to determine whether two geometries are disjoint.
TheDisjoint predicate has the following equivalent definitions:
- The two geometries have no point in common
- The DE-9IM Intersection Matrix for the two geometries matches
[FF*FF****] Intersects() = false
(Disjointis the inverse ofIntersects)
Declaration
public static TopologyPredicate Disjoint()
Returns
| Type | Description |
|---|---|
| TopologyPredicate | The predicate instance |
See Also
| Edit this page View SourceEqualsTopologically()
Creates a predicate to determine whether two geometries are topologically equal.
TheEquals predicate has the following equivalent definitions:
- The two geometries have at least one point in common, and no point of either geometry lies in the exterior of the other geometry.
- The DE-9IM Intersection Matrix for the two geometries matches
the pattern
T*F**FFF*
Declaration
public static TopologyPredicate EqualsTopologically()
Returns
| Type | Description |
|---|---|
| TopologyPredicate | The predicate instance |
Intersects()
Creates a predicate to determine whether two geometries intersect.
TheIntersects predicate has the following equivalent definitions:
- The two geometries have at least one point in common
- The DE-9IM Intersection Matrix for the two geometries matches
at least one of the patterns
[T********][*T*******][***T*****][****T****]
Disjoint() = false
(Intersectsis the inverse ofDisjoint)
Declaration
public static TopologyPredicate Intersects()
Returns
| Type | Description |
|---|---|
| TopologyPredicate | The predicate instance |
See Also
| Edit this page View SourceMatches(string)
Creates a predicate that matches a DE-9IM matrix pattern.
Declaration
public static TopologyPredicate Matches(string imPattern)
Parameters
| Type | Name | Description |
|---|---|---|
| string | imPattern | The pattern to match |
Returns
| Type | Description |
|---|---|
| TopologyPredicate | A predicate that matches the pattern |
See Also
| Edit this page View SourceOverlaps()
Creates a predicate to determine whether a geometry overlaps another geometry.
TheOverlaps predicate has the following equivalent definitions:
- The geometries have at least one point each not shared by the other (or equivalently neither covers the other), they have the same dimension, and the intersection of the interiors of the two geometries has the same dimension as the geometries themselves.
- The DE-9IM Intersection Matrix for the two geometries matches
[T*T***T**](for P/P and A/A cases) or[1*T***T**](for L/L cases)
false.
This predicate is symmetric.
Declaration
public static TopologyPredicate Overlaps()
Returns
| Type | Description |
|---|---|
| TopologyPredicate | The predicate instance |
Touches()
Creates a predicate to determine whether a geometry touches another geometry.
TheTouches predicate has the following equivalent definitions:
- The geometries have at least one point in common, but their interiors do not intersect.
- The DE-9IM Intersection Matrix for the two geometries matches
at least one of the following patterns
[FT*******][F**T*****][F***T****]
false,
since points have only interiors.
This predicate is symmetric.
Declaration
public static TopologyPredicate Touches()
Returns
| Type | Description |
|---|---|
| TopologyPredicate | The predicate instance |
Within()
Creates a predicate to determine whether a geometry is within another geometry.
TheWithin predicate has the following equivalent definitions:
- Every point of this geometry is a point of the other geometry, and the interiors of the two geometries have at least one point in common.
- The DE-9IM Intersection Matrix for the two geometries matches
[T*F**F***] contains(B, A) = true
(Withinis the converse of Contains())
within(B, A) = false
(As a concrete example, take A to be a LineString which lies in the boundary of a Polygon B.)
For a predicate with similar behavior but avoiding
this subtle limitation, see CoveredBy().
Declaration
public static TopologyPredicate Within()
Returns
| Type | Description |
|---|---|
| TopologyPredicate | The predicate instance |