Class GeometryRelate
Class which provides the available Relate operations for NtsGeometryServices.
Inherited Members
Namespace: NetTopologySuite.Geometries
Assembly: NetTopologySuite.dll
Syntax
public abstract class GeometryRelate
Properties
| Edit this page View SourceLegacy
Gets a value indicating a geometry relation predicate computation class that uses old NTS relate function set.
Declaration
public static GeometryRelate Legacy { get; }
Property Value
Type | Description |
---|---|
GeometryRelate |
NG
Gets a value indicating a geometry relation predicate computation class that uses next-generation NTS relate function set.
Declaration
public static GeometryRelate NG { get; }
Property Value
Type | Description |
---|---|
GeometryRelate |
Methods
| Edit this page View SourceContains(Geometry, Geometry)
Tests if the input geometry a
contains the input geometry b
.
Contains
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
(contains
is the converse of Within(Geometry, Geometry))
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(Geometry, Geometry).
Declaration
public abstract bool Contains(Geometry a, Geometry b)
Parameters
Type | Name | Description |
---|---|---|
Geometry | a | The A input geometry |
Geometry | b | The B input geometry |
Returns
Type | Description |
---|---|
bool |
|
See Also
| Edit this page View SourceCoveredBy(Geometry, Geometry)
Tests if the input geometry a
is covered by the input geometry b
CoveredBy
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
(CoveredBy
is the converse of Covers(Geometry, Geometry))
false
.
This predicate is similar to {@link #within},
but is more inclusive (i.e. returns true
for more cases).
Declaration
public abstract bool CoveredBy(Geometry a, Geometry b)
Parameters
Type | Name | Description |
---|---|---|
Geometry | a | The A input geometry |
Geometry | b | The B input geometry |
Returns
Type | Description |
---|---|
bool |
|
See Also
| Edit this page View SourceCovers(Geometry, Geometry)
Tests if the input geometry a
covers the input geometry b
Covers
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
(Covers
is the converse of CoveredBy(Geometry, Geometry))
false
.
This predicate is similar to Contains(Geometry, Geometry),
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 abstract bool Covers(Geometry a, Geometry b)
Parameters
Type | Name | Description |
---|---|---|
Geometry | a | The A input geometry |
Geometry | b | The B input geometry |
Returns
Type | Description |
---|---|
bool |
|
See Also
| Edit this page View SourceCrosses(Geometry, Geometry)
Tests if the input geometry a
crosses the input geometry b
Crosses
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:
[T*T******]
(for P/L, P/A, and L/A cases)[T*****T**]
(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 abstract bool Crosses(Geometry a, Geometry b)
Parameters
Type | Name | Description |
---|---|---|
Geometry | a | The A input geometry |
Geometry | b | The B input geometry |
Returns
Type | Description |
---|---|
bool |
|
Disjoint(Geometry, Geometry)
Tests if the input geometry a
and b
are disjoint.
Disjoint
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
(Disjoint
is the inverse ofIntersects
)
Declaration
public abstract bool Disjoint(Geometry a, Geometry b)
Parameters
Type | Name | Description |
---|---|---|
Geometry | a | The A input geometry |
Geometry | b | The B input geometry |
Returns
Type | Description |
---|---|
bool |
|
See Also
| Edit this page View SourceEqualsTopologically(Geometry, Geometry)
Tests if the input geometry a
and b
are topologically equal.
Equals
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 abstract bool EqualsTopologically(Geometry a, Geometry b)
Parameters
Type | Name | Description |
---|---|---|
Geometry | a | The A input geometry |
Geometry | b | The B input geometry |
Returns
Type | Description |
---|---|
bool |
|
Intersects(Geometry, Geometry)
Tests if the input geometries a
and b
intersect.
Intersects
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
(Intersects
is the inverse ofDisjoint
)
Declaration
public abstract bool Intersects(Geometry a, Geometry b)
Parameters
Type | Name | Description |
---|---|---|
Geometry | a | The A input geometry |
Geometry | b | The B input geometry |
Returns
Type | Description |
---|---|
bool |
|
See Also
| Edit this page View SourceOverlaps(Geometry, Geometry)
Test if the input geometry a
overlaps the input geometry b
.
Overlaps
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 abstract bool Overlaps(Geometry a, Geometry b)
Parameters
Type | Name | Description |
---|---|---|
Geometry | a | The A input geometry |
Geometry | b | The B input geometry |
Returns
Type | Description |
---|---|
bool |
|
Relate(Geometry, Geometry)
Computes the DE-9IM matrix for the topological relationship between two geometries.
Declaration
public abstract IntersectionMatrix Relate(Geometry a, Geometry b)
Parameters
Type | Name | Description |
---|---|---|
Geometry | a | The A input geometry |
Geometry | b | The B input geometry |
Returns
Type | Description |
---|---|
IntersectionMatrix | The DE-9IM matrix for the topological relationship |
Relate(Geometry, Geometry, string)
Tests if the input geometry b
relates to
a
in the way defined by intersectionPattern
Declaration
public abstract bool Relate(Geometry a, Geometry b, string intersectionPattern)
Parameters
Type | Name | Description |
---|---|---|
Geometry | a | The A input geometry |
Geometry | b | The B input geometry |
string | intersectionPattern | The encoded DE-9IM pattern describing the topological relation to test |
Returns
Type | Description |
---|---|
bool |
|
Touches(Geometry, Geometry)
Tests if the input geometry a
touches the b
.
Touches
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 abstract bool Touches(Geometry a, Geometry b)
Parameters
Type | Name | Description |
---|---|---|
Geometry | a | The A input geometry |
Geometry | b | The B input geometry |
Returns
Type | Description |
---|---|
bool |
|
Within(Geometry, Geometry)
Tests if the the input geometry a
is within the input geometry b
.
Within
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
(Within
is the converse of Contains(Geometry, Geometry))
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(Geometry, Geometry).
Declaration
public abstract bool Within(Geometry a, Geometry b)
Parameters
Type | Name | Description |
---|---|---|
Geometry | a | The A input geometry |
Geometry | b | The B input geometry |
Returns
Type | Description |
---|---|
bool |
|