Class Geometry
A representation of a planar, linear vector geometry.
Inherited Members
Namespace: NetTopologySuite.Geometries
Assembly: NetTopologySuite.dll
Syntax
[Serializable]
public abstract class Geometry : IComparable, IComparable<Geometry>
Remarks
Binary Predicates:
Because it is not clear at this time what semantics for spatial analysis methods involvingGeometryCollection
s would be useful,
GeometryCollection
s are not supported as arguments to binary
predicates or the Relate
method.
Overlay Methods:
The spatial analysis methods will return the most specific class possible to represent the result. If the result is homogeneous, aPoint
, LineString
, or
Polygon
will be returned if the result contains a single
element; otherwise, a MultiPoint
, MultiLineString
,
or MultiPolygon
will be returned. If the result is
heterogeneous a GeometryCollection
will be returned.
Representation of Computed Geometries:
The SFS states that the result
of a set-theoretic method is the "point-set" result of the usual
set-theoretic definition of the operation (SFS 3.2.21.1). However, there are
sometimes many ways of representing a point set as a Geometry
.
The SFS does not specify an unambiguous representation of a given point set
returned from a spatial analysis method. One goal of NTS is to make this
specification precise and unambiguous. NTS uses a canonical form for
Geometry
s returned from overlay methods. The canonical
form is a Geometry
which is simple and noded:
Simple means that the Geometry returned will be simple according to
the NTS definition of IsSimple
.
Noded applies only to overlays involving LineString
s. It
means that all intersection points on LineString
s will be
present as endpoints of LineString
s in the result.
This definition implies that non-simple geometries which are arguments to
spatial analysis methods must be subjected to a line-dissolve process to
ensure that the results are simple.
Constructed Points And The Precision Model:
The results computed by the set-theoretic methods may
contain constructed points which are not present in the input Geometry
s.
These new points arise from intersections between line segments in the
edges of the input Geometry
s. In the general case it is not
possible to represent constructed points exactly. This is due to the fact
that the coordinates of an intersection point may contain twice as many bits
of precision as the coordinates of the input line segments. In order to
represent these constructed points explicitly, NTS must truncate them to fit
the PrecisionModel
.
Unfortunately, truncating coordinates moves them slightly. Line segments
which would not be coincident in the exact result may become coincident in
the truncated representation. This in turn leads to "topology collapses" --
situations where a computed element has a lower dimension than it would in
the exact result.
When NTS detects topology collapses during the computation of spatial
analysis methods, it will throw an exception. If possible the exception will
report the location of the collapse.
Geometry Equality
There are two ways of comparing geometries for equality: structural equality and topological equality.Structural Equality
Structural Equality is provided by the EqualsExact(Geometry) method. This implements a comparison based on exact, structural pointwise equality. The Equals(Object) is a synonym for this method, to provide structural equality semantics for use in collections. It is important to note that structural pointwise equality is easily affected by things like ring order and component order. In many situations it will be desirable to normalize geometries before comparing them (using the Normalized() or Normalize() methods). EqualsNormalized(Geometry) is provided as a convenience method to compute equality over normalized geometries, but it is expensive to use. Finally, EqualsExact(Geometry, Double) allows using a tolerance value for point comparison.Topological Equality
Topological Equality is provided by the EqualsTopologically(Geometry) method. It implements the SFS definition of point-set equality defined in terms of the DE-9IM matrix. To support the SFS naming convention, the method Equals(Geometry) is also provided as a synonym. However, due to the potential for confusion with Equals(Object) its use is discouraged.Since Equals(Object) and GetHashCode() are overridden, Geometries can be used effectively in .Net collections.
Constructors
| Improve this Doc View SourceGeometry(GeometryFactory)
Creates a new Geometry
via the specified GeometryFactory.
Declaration
protected Geometry(GeometryFactory factory)
Parameters
Type | Name | Description |
---|---|---|
GeometryFactory | factory | The factory |
Fields
| Improve this Doc View SourceDefaultFactory
A predefined GeometryFactory with PrecisionModel ==
Fixed.
Declaration
public static readonly GeometryFactory DefaultFactory
Field Value
Type | Description |
---|---|
GeometryFactory |
See Also
| Improve this Doc View SourceTypeNameGeometryCollection
The name of geometry collection geometries.
Declaration
public const string TypeNameGeometryCollection = "GeometryCollection"
Field Value
Type | Description |
---|---|
String |
TypeNameLinearRing
The name of linearring geometries
Declaration
public const string TypeNameLinearRing = "LinearRing"
Field Value
Type | Description |
---|---|
String |
TypeNameLineString
The name of linestring geometries
Declaration
public const string TypeNameLineString = "LineString"
Field Value
Type | Description |
---|---|
String |
TypeNameMultiLineString
The name of multi-linestring geometries
Declaration
public const string TypeNameMultiLineString = "MultiLineString"
Field Value
Type | Description |
---|---|
String |
TypeNameMultiPoint
The name of multi-point geometries
Declaration
public const string TypeNameMultiPoint = "MultiPoint"
Field Value
Type | Description |
---|---|
String |
TypeNameMultiPolygon
The name of multi-polygon geometries
Declaration
public const string TypeNameMultiPolygon = "MultiPolygon"
Field Value
Type | Description |
---|---|
String |
TypeNamePoint
The name of point geometries
Declaration
public const string TypeNamePoint = "Point"
Field Value
Type | Description |
---|---|
String |
TypeNamePolygon
The name of polygon geometries
Declaration
public const string TypeNamePolygon = "Polygon"
Field Value
Type | Description |
---|---|
String |
Properties
| Improve this Doc View SourceArea
Returns the area of this Geometry
.
Areal Geometries have a non-zero area.
They override this function to compute the area.
Others return 0.0
Declaration
public virtual double Area { get; }
Property Value
Type | Description |
---|---|
Double | The area of the Geometry. |
Boundary
Returns the boundary, or an empty geometry of appropriate dimension
if this Geometry
is empty.
For a discussion of this function, see the OpenGIS Simple
Features Specification. As stated in SFS Section 2.1.13.1, "the boundary
of a Geometry is a set of Geometries of the next lower dimension."
Declaration
public abstract Geometry Boundary { get; }
Property Value
Type | Description |
---|---|
Geometry | The closure of the combinatorial boundary of this |
BoundaryDimension
Returns the dimension of this Geometry
s inherent boundary.
Declaration
public abstract Dimension BoundaryDimension { get; }
Property Value
Type | Description |
---|---|
Dimension | The dimension of the boundary of the class implementing this
interface, whether or not this object is the empty point. Returns
|
Centroid
Computes the centroid of this Geometry
.
The centroid
is equal to the centroid of the set of component Geometries of highest
dimension (since the lower-dimension geometries contribute zero
"weight" to the centroid).
The centroid of an empty geometry is POINT EMPTY
.
Declaration
public virtual Point Centroid { get; }
Property Value
Type | Description |
---|---|
Point | A Point which is the centroid of this Geometry. |
Coordinate
Returns a vertex of this Geometry
(usually, but not necessarily, the first one).
Declaration
public abstract Coordinate Coordinate { get; }
Property Value
Type | Description |
---|---|
Coordinate | a Coordinate which is a vertex of this |
Remarks
The returned coordinate should not be assumed to be an actual Coordinate object used in the internal representation.
Coordinates
Returns an array containing the values of all the vertices for this geometry.
Declaration
public abstract Coordinate[] Coordinates { get; }
Property Value
Type | Description |
---|---|
Coordinate[] | The vertices of this |
Remarks
If the geometry is a composite, the array will contain all the vertices for the components, in the order in which the components occur in the geometry.
In general, the array cannot be assumed to be the actual internal storage for the vertices. Thus modifying the array may not modify the geometry itself. Use the SetOrdinate(Int32, Int32, Double) or SetOrdinate(Int32, Ordinate, Double) method (possibly on the components) to modify the underlying data. If the coordinates are modified, GeometryChanged() must be called afterwards.
See Also
| Improve this Doc View SourceDimension
Returns the dimension of this geometry.
Declaration
public abstract Dimension Dimension { get; }
Property Value
Type | Description |
---|---|
Dimension | The topological dimensions of this geometry |
Remarks
The dimension of a geometry is is the topological dimension of its embedding in the 2-D Euclidean plane. In the NTS spatial model, dimension values are in the set {0,1,2}.
Note that this is a different concept to the dimension of the vertex Coordinates. The geometry dimension can never be greater than the coordinate dimension. For example, a 0-dimensional geometry (e.g. a Point) may have a coordinate dimension of 3 (X,Y,Z).
Envelope
Gets a geometry representing the envelope (bounding box) of this Geometry
.
Declaration
public Geometry Envelope { get; }
Property Value
Type | Description |
---|---|
Geometry | A Geometry representing the envelope of this Geometry |
Remarks
If this Geometry
is
- empty, returns an empty
Point
- a point, returns a
Point
- a line parallel to an axis, a two-vertex
LineString
, - otherwise, returns a
Polygon
whose vertices are (minx, miny), (maxx, miny), (maxx, maxy), (minx, maxy), (minx, miny).
See Also
| Improve this Doc View SourceEnvelopeInternal
Gets an Envelope containing
the minimum and maximum x and y values in this Geometry
.
If the geometry is empty, an empty Envelope
is returned.
Declaration
public Envelope EnvelopeInternal { get; }
Property Value
Type | Description |
---|---|
Envelope | the envelope of this |
Remarks
The returned object is a copy of the one maintained internally, to avoid aliasing issues. For best performance, clients which access this envelope frequently should cache the return value.
Factory
Gets the factory which contains the context in which this point was created.
Declaration
public GeometryFactory Factory { get; }
Property Value
Type | Description |
---|---|
GeometryFactory | The factory for this point. |
GeometryType
Returns the name of this Geometry's actual class.
Declaration
public abstract string GeometryType { get; }
Property Value
Type | Description |
---|---|
String | The name of this |
InteriorPoint
Computes an interior point of this Geometry
.
Declaration
public virtual Point InteriorPoint { get; }
Property Value
Type | Description |
---|---|
Point | A |
Remarks
An interior point is guaranteed to lie in the interior of the Geometry, if it possible to calculate such a point exactly. Otherwise, the point may lie on the boundary of the point.
The interior point of an empty geometry is POINT EMPTY
.
IsEmpty
Tests whether the set of points covered in this Geometry
is empty.
Note this test is for topological emptiness, not structural emptiness.
A collection containing only empty elements is reported as empty.
To check structural emptiness use NumGeometries.
Declaration
public abstract bool IsEmpty { get; }
Property Value
Type | Description |
---|---|
Boolean |
|
IsGeometryCollection
Tests whether this is an instance of a general {@link GeometryCollection}, rather than a homogeneous subclass.
Declaration
protected bool IsGeometryCollection { get; }
Property Value
Type | Description |
---|---|
Boolean |
|
IsRectangle
Tests whether this is a rectangular Polygon.
Declaration
public virtual bool IsRectangle { get; }
Property Value
Type | Description |
---|---|
Boolean |
|
Remarks
Polygon overrides to check for actual rectangle.
IsSimple
Tests whether this Geometry is simple.
The SFS definition of simplicity follows the general rule that a Geometry is simple if it has no points of self-tangency, self-intersection or other anomalous points.
Simplicity is defined for each Geometry subclass as follows:
- Valid polygonal geometries are simple, since their rings
must not self-intersect.
IsSimple
tests for this condition and reportsfalse
if it is not met. (This is a looser test than checking for validity). - Linear rings have the same semantics.
- Linear geometries are simple if they do not self-intersect at points other than boundary points.
- Zero-dimensional geometries (points) are simple if they have no repeated points.
- Empty
Geometry
s are always simple.
Declaration
public virtual bool IsSimple { get; }
Property Value
Type | Description |
---|---|
Boolean |
|
See Also
| Improve this Doc View SourceIsValid
Tests whether this Geometry
is topologically
valid, according to the OGC SFS specification.
For validity rules see the documentation for the specific geometry subclass.
Declaration
public virtual bool IsValid { get; }
Property Value
Type | Description |
---|---|
Boolean |
|
Length
Returns the length of this Geometry
.
Linear geometries return their length.
Areal geometries return their perimeter.
They override this function to compute the length.
Others return 0.0
Declaration
public virtual double Length { get; }
Property Value
Type | Description |
---|---|
Double | The length of the Geometry. |
NumGeometries
Returns the number of Geometryes in a GeometryCollection, or 1, if the geometry is not a collection.
Declaration
public virtual int NumGeometries { get; }
Property Value
Type | Description |
---|---|
Int32 |
NumPoints
Returns the count of this Geometry
s vertices. The Geometry
s contained by composite Geometry
s must be
Geometry's; that is, they must implement NumPoints
.
Declaration
public abstract int NumPoints { get; }
Property Value
Type | Description |
---|---|
Int32 | The number of vertices in this |
OgcGeometryType
Gets the OGC geometry type
Declaration
public abstract OgcGeometryType OgcGeometryType { get; }
Property Value
Type | Description |
---|---|
OgcGeometryType |
PointOnSurface
Declaration
public Point PointOnSurface { get; }
Property Value
Type | Description |
---|---|
Point |
PrecisionModel
Returns the PrecisionModel
used by the Geometry
.
Declaration
public PrecisionModel PrecisionModel { get; }
Property Value
Type | Description |
---|---|
PrecisionModel | the specification of the grid of allowable points, for this
|
SortIndex
Gets a value to sort the geometry
Declaration
protected abstract Geometry.SortIndexValue SortIndex { get; }
Property Value
Type | Description |
---|---|
Geometry.SortIndexValue |
Remarks
NOTE:
For JTS v1.17 this property's getter has been renamed to getTypeCode()
.
In order not to break binary compatibility we did not follow.
SRID
Sets the ID of the Spatial Reference System used by the Geometry
.
Declaration
public int SRID { get; set; }
Property Value
Type | Description |
---|---|
Int32 |
Remarks
NOTE: This method should only be used for exceptional circumstances or
for backwards compatibility. Normally the SRID
should be set on the
GeometryFactory used to create the geometry.
SRID
s set using this method will change the Factory.
See Also
| Improve this Doc View SourceUserData
Gets/Sets the user data object for this point, if any.
Declaration
public object UserData { get; set; }
Property Value
Type | Description |
---|---|
Object |
Remarks
A simple scheme for applications to add their own custom data to a Geometry. An example use might be to add an object representing a Coordinate Reference System. Note that user data objects are not present in geometries created by construction methods.
Methods
| Improve this Doc View SourceApply(ICoordinateFilter)
Performs an operation with or on this Geometry
's coordinates.
Declaration
public abstract void Apply(ICoordinateFilter filter)
Parameters
Type | Name | Description |
---|---|---|
ICoordinateFilter | filter | The filter to apply to this |
Remarks
If this method modifies any coordinate values, GeometryChanged() must be called to update the geometry state. Note that you cannot use this method to modify this Geometry if its underlying CoordinateSequence's #get method returns a copy of the Coordinate, rather than the actual Coordinate stored (if it even stores Coordinate objects at all).
Apply(ICoordinateSequenceFilter)
Performs an operation on the coordinates in this Geometry
's CoordinateSequences.
Declaration
public abstract void Apply(ICoordinateSequenceFilter filter)
Parameters
Type | Name | Description |
---|---|---|
ICoordinateSequenceFilter | filter | The filter to apply |
Remarks
If the filter reports that a coordinate value has been changed, GeometryChanged() will be called automatically.
Apply(IEntireCoordinateSequenceFilter)
Performs an operation on this Geometry
's CoordinateSequences.
Declaration
public virtual void Apply(IEntireCoordinateSequenceFilter filter)
Parameters
Type | Name | Description |
---|---|---|
IEntireCoordinateSequenceFilter | filter | The filter to apply |
Remarks
If the filter reports that a coordinate value has been changed, GeometryChanged() will be called automatically.
Apply(IGeometryComponentFilter)
Performs an operation with or on this Geometry and its component Geometry's. Only GeometryCollections and Polygons have component Geometry's; for Polygons they are the LinearRings of the shell and holes.
Declaration
public abstract void Apply(IGeometryComponentFilter filter)
Parameters
Type | Name | Description |
---|---|---|
IGeometryComponentFilter | filter | The filter to apply to this |
Apply(IGeometryFilter)
Performs an operation with or on this Geometry
and its
subelement Geometry
s (if any).
Only GeometryCollections and subclasses
have subelement Geometry's.
Declaration
public abstract void Apply(IGeometryFilter filter)
Parameters
Type | Name | Description |
---|---|---|
IGeometryFilter | filter | The filter to apply to this |
AsBinary()
Declaration
public byte[] AsBinary()
Returns
Type | Description |
---|---|
Byte[] |
AsText()
Declaration
public string AsText()
Returns
Type | Description |
---|---|
String |
Buffer(Double)
Computes a buffer area around this geometry having the given width. The
buffer of a Geometry is the Minkowski sum or difference of the geometry
with a disc of radius Abs(distance)
.
Declaration
public Geometry Buffer(double distance)
Parameters
Type | Name | Description |
---|---|---|
Double | distance | The width of the buffer (may be positive, negative or 0), interpreted according to the
|
Returns
Type | Description |
---|---|
Geometry | a polygonal geometry representing the buffer region (which may be empty) |
Remarks
Mathematically-exact buffer area boundaries can contain circular arcs. To represent these arcs using linear geometry they must be approximated with line segments. The buffer geometry is constructed using 8 segments per quadrant to approximate the circular arcs.
The end cap style is EndCapStyle.Round
.
The buffer operation always returns a polygonal result. The negative or zero-distance buffer of lines and points is always an empty IPolygonal. This is also the result for the buffers of degenerate (zero-area) polygons.
Exceptions
Type | Condition |
---|---|
TopologyException | If a robustness error occurs |
See Also
Buffer(Double, BufferParameters)
Computes a buffer region around this Geometry
having the given
width and with a specified number of segments used to approximate curves.
The buffer of a Geometry is the Minkowski sum of the Geometry with
a disc of radius distance
. Curves in the buffer polygon are
approximated with line segments. This method allows specifying the
accuracy of that approximation.
Declaration
public Geometry Buffer(double distance, BufferParameters bufferParameters)
Parameters
Type | Name | Description |
---|---|---|
Double | distance | The width of the buffer, interpreted according to the
|
BufferParameters | bufferParameters | This argument type has a number of properties that control the construction of the
buffer, including |
Returns
Type | Description |
---|---|
Geometry | a polygonal geometry representing the buffer region (which may be empty) |
Remarks
Mathematically-exact buffer area boundaries can contain circular arcs.
To represent these arcs using linear geometry they must be approximated with line segments.
The bufferParameters
argument has a property QuadrantSegments
controlling the accuracy of
the approximation by specifying the number of line segments used to
represent a quadrant of a circle
The EndCapStyle
property of the bufferParameters
argument specifies the buffer geometry that will be
created at the ends of linestrings. The styles provided are:
- Round - (default) a semi-circle
- Flat - a straight line perpendicular to the end segment
- Square - a half-square
The buffer operation always returns a polygonal result. The negative or zero-distance buffer of lines and points is always an empty IPolygonal. This is also the result for the buffers of degenerate (zero-area) polygons.
Exceptions
Type | Condition |
---|---|
TopologyException | If a robustness error occurs |
See Also
| Improve this Doc View SourceBuffer(Double, EndCapStyle)
Computes a buffer region around this Geometry
having the given width.
The buffer of a Geometry is the Minkowski sum or difference of the geometry
with a disc of radius Abs(distance)
.
Declaration
public Geometry Buffer(double distance, EndCapStyle endCapStyle)
Parameters
Type | Name | Description |
---|---|---|
Double | distance | The width of the buffer, interpreted according to the
|
EndCapStyle | endCapStyle | Cap Style to use for compute buffer. |
Returns
Type | Description |
---|---|
Geometry | a polygonal geometry representing the buffer region (which may be empty) |
Remarks
The end cap style specifies the buffer geometry that will be created at the ends of linestrings. The styles provided are:
- Round - (default) a semi-circle
- Flat - a straight line perpendicular to the end segment
- Square - a half-square
The buffer operation always returns a polygonal result. The negative or zero-distance buffer of lines and points is always an empty IPolygonal.
Exceptions
Type | Condition |
---|---|
TopologyException | If a robustness error occurs |
See Also
Buffer(Double, Int32)
Computes a buffer region around this Geometry
having the given
width and with a specified accuracy of approximation for circular arcs.
The buffer of a Geometry is the Minkowski sum of the Geometry with
a disc of radius distance
. Curves in the buffer polygon are
approximated with line segments. This method allows specifying the
accuracy of that approximation.
Declaration
public Geometry Buffer(double distance, int quadrantSegments)
Parameters
Type | Name | Description |
---|---|---|
Double | distance | The width of the buffer (may be positive, negative or 0), interpreted according to the
|
Int32 | quadrantSegments | The number of segments to use to approximate a quadrant of a circle. |
Returns
Type | Description |
---|---|
Geometry | a polygonal geometry representing the buffer region (which may be empty) |
Remarks
Mathematically-exact buffer area boundaries can contain circular arcs.
To represent these arcs using linear geometry they must be approximated with line segments.
The quadrantSegments
argument allows controlling the accuracy of
the approximation by specifying the number of line segments used to
represent a quadrant of a circle
The buffer operation always returns a polygonal result. The negative or zero-distance buffer of lines and points is always an empty IPolygonal. This is also the result for the buffers of degenerate (zero-area) polygons.
Exceptions
Type | Condition |
---|---|
TopologyException | If a robustness error occurs |
See Also
Buffer(Double, Int32, EndCapStyle)
Computes a buffer region around this Geometry
having the given
width and with a specified number of segments used to approximate curves.
The buffer of a Geometry is the Minkowski sum of the Geometry with
a disc of radius distance
. Curves in the buffer polygon are
approximated with line segments. This method allows specifying the
accuracy of that approximation.
Declaration
public Geometry Buffer(double distance, int quadrantSegments, EndCapStyle endCapStyle)
Parameters
Type | Name | Description |
---|---|---|
Double | distance | The width of the buffer, interpreted according to the
|
Int32 | quadrantSegments | The number of segments to use to approximate a quadrant of a circle. |
EndCapStyle | endCapStyle | Cap Style to use for compute buffer. |
Returns
Type | Description |
---|---|
Geometry | a polygonal geometry representing the buffer region (which may be empty) |
Remarks
Mathematically-exact buffer area boundaries can contain circular arcs.
To represent these arcs using linear geometry they must be approximated with line segments.
The quadrantSegments
argument allows controlling the accuracy of
the approximation by specifying the number of line segments used to
represent a quadrant of a circle
The end cap style specifies the buffer geometry that will be created at the ends of linestrings. The styles provided are:
- Round - (default) a semi-circle
- Flat - a straight line perpendicular to the end segment
- Square - a half-square
The buffer operation always returns a polygonal result. The negative or zero-distance buffer of lines and points is always an empty IPolygonal. This is also the result for the buffers of degenerate (zero-area) polygons.
Exceptions
Type | Condition |
---|---|
TopologyException | If a robustness error occurs |
See Also
| Improve this Doc View SourceCheckNotGeometryCollection(Geometry)
Throws an exception if g
's type is a GeometryCollection
.
(Its subclasses do not trigger an exception).
Declaration
protected static void CheckNotGeometryCollection(Geometry g)
Parameters
Type | Name | Description |
---|---|---|
Geometry | g | The |
Exceptions
Type | Condition |
---|---|
ArgumentException | if |
Compare(List<Geometry>, List<Geometry>)
Returns the first non-zero result of CompareTo
encountered as
the two Collection
s are iterated over. If, by the time one of
the iterations is complete, no non-zero result has been encountered,
returns 0 if the other iteration is also complete. If b
completes before a
, a positive number is returned; if a
before b, a negative number.
Declaration
protected static int Compare(List<Geometry> a, List<Geometry> b)
Parameters
Type | Name | Description |
---|---|---|
List<Geometry> | a | A |
List<Geometry> | b | A |
Returns
Type | Description |
---|---|
Int32 | The first non-zero |
CompareTo(Geometry)
Returns whether this Geometry
is greater than, equal to,
or less than another Geometry
.
Declaration
public int CompareTo(Geometry geom)
Parameters
Type | Name | Description |
---|---|---|
Geometry | geom | A |
Returns
Type | Description |
---|---|
Int32 | A positive number, 0, or a negative number, depending on whether
this object is greater than, equal to, or less than |
Remarks
If their classes are different, they are compared using the following ordering:
- Point (lowest),
- MultiPoint,
- LineString,
- LinearRing,
- MultiLineString,
- Polygon,
- MultiPolygon,
- GeometryCollection (highest).
Geometry
s have the same class, their first
elements are compared. If those are the same, the second elements are
compared, etc.
CompareTo(Object)
Returns whether this Geometry
is greater than, equal to,
or less than another Geometry
.
Declaration
public int CompareTo(object o)
Parameters
Type | Name | Description |
---|---|---|
Object | o | A |
Returns
Type | Description |
---|---|
Int32 | A positive number, 0, or a negative number, depending on whether
this object is greater than, equal to, or less than |
Remarks
If their classes are different, they are compared using the following ordering:
- Point (lowest),
- MultiPoint,
- LineString,
- LinearRing,
- MultiLineString,
- Polygon,
- MultiPolygon,
- GeometryCollection (highest).
Geometry
s have the same class, their first
elements are compared. If those are the same, the second elements are
compared, etc.
CompareTo(Object, IComparer<CoordinateSequence>)
Returns whether this Geometry
is greater than, equal to,
or less than another Geometry
, using the given
Declaration
public int CompareTo(object o, IComparer<CoordinateSequence> comp)
Parameters
Type | Name | Description |
---|---|---|
Object | o | A |
IComparer<CoordinateSequence> | comp | A |
Returns
Type | Description |
---|---|
Int32 | A positive number, 0, or a negative number, depending on whether
this object is greater than, equal to, or less than |
Remarks
If their classes are different, they are compared using the following ordering:
- Point (lowest),
- MultiPoint,
- LineString,
- LinearRing,
- MultiLineString,
- Polygon,
- MultiPolygon,
- GeometryCollection (highest).
Geometry
s have the same class, their first
elements are compared. If those are the same, the second elements are
compared, etc.
CompareToSameClass(Object)
Returns whether this Geometry
is greater than, equal to,
or less than another Geometry
having the same class.
Declaration
protected abstract int CompareToSameClass(object o)
Parameters
Type | Name | Description |
---|---|---|
Object | o | A |
Returns
Type | Description |
---|---|
Int32 | A positive number, 0, or a negative number, depending on whether
this object is greater than, equal to, or less than |
CompareToSameClass(Object, IComparer<CoordinateSequence>)
Returns whether this Geometry
is greater than, equal to,
or less than another Geometry
of the same class.
using the given IComparer<T>.
Declaration
protected abstract int CompareToSameClass(object o, IComparer<CoordinateSequence> comp)
Parameters
Type | Name | Description |
---|---|---|
Object | o | A |
IComparer<CoordinateSequence> | comp | The comparer |
Returns
Type | Description |
---|---|
Int32 | A positive number, 0, or a negative number, depending on whether
this object is greater than, equal to, or less than |
ComputeEnvelopeInternal()
Returns the minimum and maximum x and y values in this Geometry
,
or a null Envelope
if this Geometry
is empty.
Unlike EnvelopeInternal
, this method calculates the Envelope
each time it is called; EnvelopeInternal
caches the result
of this method.
Declaration
protected abstract Envelope ComputeEnvelopeInternal()
Returns
Type | Description |
---|---|
Envelope | This |
Contains(Geometry)
Tests whether this geometry contains the argument geometry.
Declaration
public virtual bool Contains(Geometry g)
Parameters
Type | Name | Description |
---|---|---|
Geometry | g | the |
Returns
Type | Description |
---|---|
Boolean |
|
Remarks
The 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*]
g.within(this)
(Contains
is the converse of Within(Geometry))
An implication of the definition is that "Geometries do not
contain their boundary". In other words, if a geometry A is a subset of
the points in the boundary of a geometry B, 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 behaviour but avoiding
this subtle limitation, see Covers(Geometry).
ConvexHull()
Returns the smallest convex Polygon
that contains all the
points in the Geometry
. This obviously applies only to Geometry
s which contain 3 or more points.
Declaration
public virtual Geometry ConvexHull()
Returns
Type | Description |
---|---|
Geometry | the minimum-area convex polygon containing this |
Copy()
Creates a deep copy of this Geometry object.
Coordinate sequences contained in it are copied.
All instance fields are copied
(i.e. the SRID
, EnvelopeInternal
and UserData
).
Declaration
public Geometry Copy()
Returns
Type | Description |
---|---|
Geometry | A deep copy of this geometry |
Remarks
NOTE: The UserData object reference (if present) is copied, but the value itself is not copied. If a deep copy is required this must be performed by the caller.
CopyInternal()
An internal method to copy subclass-specific geometry data.
Declaration
protected abstract Geometry CopyInternal()
Returns
Type | Description |
---|---|
Geometry | A copy of the target geometry object. |
CoveredBy(Geometry)
Tests whether this geometry is covered by the specified geometry.
Declaration
public bool CoveredBy(Geometry g)
Parameters
Type | Name | Description |
---|---|---|
Geometry | g | the |
Returns
Type | Description |
---|---|
Boolean |
|
Remarks
The 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***]
g.Covers(this) == true
(CoveredBy
is the converse of Covers(Geometry))
false
.
This predicate is similar to Within(Geometry),
but is more inclusive (i.e. returns true
for more cases).
See Also
| Improve this Doc View SourceCovers(Geometry)
Tests whether this geometry covers the argument geometry
Declaration
public virtual bool Covers(Geometry g)
Parameters
Type | Name | Description |
---|---|---|
Geometry | g | The |
Returns
Type | Description |
---|---|
Boolean |
|
Remarks
The 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*]
or[*T****FF*]
or[***T**FF*]
or[****T*FF*]
false
.
This predicate is similar to Contains(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 situations, Covers
should be used in preference to Contains
.
As an added benefit, Covers
is more amenable to optimization,
and hence should be more performant.
See Also
| Improve this Doc View SourceCreateArray(CoordinateSequence, Ordinate)
Declaration
protected static double[] CreateArray(CoordinateSequence sequence, Ordinate ordinate)
Parameters
Type | Name | Description |
---|---|---|
CoordinateSequence | sequence | |
Ordinate | ordinate |
Returns
Type | Description |
---|---|
Double[] |
CreateArray(Int32, Double)
Declaration
protected static double[] CreateArray(int size, double value)
Parameters
Type | Name | Description |
---|---|---|
Int32 | size | |
Double | value |
Returns
Type | Description |
---|---|
Double[] |
Crosses(Geometry)
Tests whether this geometry crosses the specified geometry.
Declaration
public virtual bool Crosses(Geometry g)
Parameters
Type | Name | Description |
---|---|---|
Geometry | g | The |
Returns
Type | Description |
---|---|
Boolean |
|
Remarks
The Crosses
predicate has the following equivalent definitions:
false
.
The SFS defined this predicate only for P/L, P/A, L/L, and L/A situations. To make the relation symmetric, NTS extends the definition to apply to L/P, A/P and A/L situations as well.
Difference(Geometry)
Computes a Geometry
representing the closure of the point-set
of the points contained in this Geometry
that are not contained in
the other
Geometry.
If the result is empty, it is an atomic geometry with the dimension of the left-hand input.
Non-empty GeometryCollection arguments are not supported.
Declaration
public Geometry Difference(Geometry other)
Parameters
Type | Name | Description |
---|---|---|
Geometry | other | The |
Returns
Type | Description |
---|---|
Geometry | A Geometry representing the point-set difference of this |
Exceptions
Type | Condition |
---|---|
ArgumentException | if the argument has a factory with a different |
Disjoint(Geometry)
Tests whether this geometry is disjoint from the argument geometry.
Declaration
public bool Disjoint(Geometry g)
Parameters
Type | Name | Description |
---|---|---|
Geometry | g | The |
Returns
Type | Description |
---|---|
Boolean |
|
Remarks
The Disjoint
predicate has the following equivalent definitions:
- The DE-9IM intersection matrix for the two geometries matches
FF*FF****
. !g.intersects(this) == true
(Disjoint
is the inverse ofIntersects
)
Distance(Geometry)
Returns the minimum distance between this Geometry
and another Geometry
g.
Declaration
public virtual double Distance(Geometry g)
Parameters
Type | Name | Description |
---|---|---|
Geometry | g | The |
Returns
Type | Description |
---|---|
Double | The distance between the geometries |
Exceptions
Type | Condition |
---|---|
ArgumentException | if g is null |
Equal(Coordinate, Coordinate, Double)
Declaration
[Obsolete("Will be removed in a future version")]
protected static bool Equal(Coordinate a, Coordinate b, double tolerance)
Parameters
Type | Name | Description |
---|---|---|
Coordinate | a | |
Coordinate | b | |
Double | tolerance |
Returns
Type | Description |
---|---|
Boolean |
Equals(Geometry)
Tests whether this geometry is topologically equal to the argument geometry.
This method is included for backward compatibility reasons. It has been superseded by the EqualsTopologically(Geometry) method, which has been named to clearly denote its functionality.
This method should NOT be confused with the method Equals(Object), which implements an exact equality comparison.
Declaration
public bool Equals(Geometry g)
Parameters
Type | Name | Description |
---|---|---|
Geometry | g | The |
Returns
Type | Description |
---|---|
Boolean |
|
See Also
| Improve this Doc View SourceEquals(Object)
Tests whether this geometry is structurally and numerically equal to a given Object.
Declaration
public override bool Equals(object o)
Parameters
Type | Name | Description |
---|---|---|
Object | o | The object to compare |
Returns
Type | Description |
---|---|
Boolean |
|
Overrides
Remarks
If the argument Object is not a Geometry
,
the result is false
.
Otherwise, the result is computed using
EqualsExact(Geometry).
This method is provided to fulfill the Java contract
for value-based object equality.
In conjunction with GetHashCode()
it provides semantics which are most useful
for using
Geometry
s as keys and values in Java collections.
Note that to produce the expected result the input geometries should be in normal form. It is the caller's responsibility to perform this where required (using Normalized() or Normalize() as appropriate).
See Also
| Improve this Doc View SourceEqualsExact(Geometry)
Returns true if the two Geometry
s are exactly equal.
Two Geometries are exactly equal if:
- they have the same class,
- they have the same values of Coordinates in their internal Coordinate lists, in exactly the same order.
This method does not
test the values of the GeometryFactory
, the SRID
,
or the UserData
fields.
To properly test equality between different geometries, it is usually necessary to Normalize() them first.
Declaration
public bool EqualsExact(Geometry other)
Parameters
Type | Name | Description |
---|---|---|
Geometry | other | The |
Returns
Type | Description |
---|---|
Boolean |
|
EqualsExact(Geometry, Double)
Returns true if the two Geometry
s are exactly equal,
up to a specified tolerance.
Two Geometries are exactly within a tolerance equal if:
- they have the same class,
- they have the same values of Coordinates, within the given tolerance distance, in their internal Coordinate lists, in exactly the same order.
GeometryFactory
, the SRID
,
or the UserData
fields.
To properly test equality between different geometries, it is usually necessary to Normalize() them first.
Declaration
public abstract bool EqualsExact(Geometry other, double tolerance)
Parameters
Type | Name | Description |
---|---|---|
Geometry | other | The |
Double | tolerance | Distance at or below which two Coordinates will be considered equal. |
Returns
Type | Description |
---|---|
Boolean |
|
See Also
| Improve this Doc View SourceEqualsNormalized(Geometry)
Tests whether two geometries are exactly equal
in their normalized forms.
This method is relatively expensive to compute.
For maximum performance, the client
should instead perform normalization on the individual geometries
at an appropriate point during processing.
Declaration
public bool EqualsNormalized(Geometry g)
Parameters
Type | Name | Description |
---|---|---|
Geometry | g | A geometry |
Returns
Type | Description |
---|---|
Boolean | true if the input geometries are exactly equal in their normalized form |
See Also
| Improve this Doc View SourceEqualsTopologically(Geometry)
Tests whether this geometry is topologically equal to the argument geometry
as defined by the SFS Equals
predicate.
Declaration
public virtual bool EqualsTopologically(Geometry g)
Parameters
Type | Name | Description |
---|---|---|
Geometry | g | the |
Returns
Type | Description |
---|---|
Boolean |
|
Remarks
The SFS 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*
T*F **F FF*
GeometryChanged()
Notifies this geometry that its coordinates have been changed by an external party (for example, via a ICoordinateFilter).
Declaration
public void GeometryChanged()
Remarks
When this method is called the geometry will flush and/or update any derived information it has cached (such as its Envelope ). The operation is applied to all component Geometries.
GeometryChangedAction()
Notifies this Geometry that its Coordinates have been changed by an external party. When GeometryChanged is called, this method will be called for this Geometry and its component Geometries.
Declaration
public void GeometryChangedAction()
GetGeometryN(Int32)
Returns an element Geometry from a GeometryCollection,
or this
, if the geometry is not a collection.
Declaration
public virtual Geometry GetGeometryN(int n)
Parameters
Type | Name | Description |
---|---|---|
Int32 | n | The index of the geometry element. |
Returns
Type | Description |
---|---|
Geometry | The n'th geometry contained in this geometry. |
GetHashCode()
Gets a hash code for the Geometry.
Declaration
public override int GetHashCode()
Returns
Type | Description |
---|---|
Int32 | An integer value suitable for use as a hashcode |
Overrides
| Improve this Doc View SourceGetOrdinates(Ordinate)
Gets an array of Double ordinate values
Declaration
public abstract double[] GetOrdinates(Ordinate ordinate)
Parameters
Type | Name | Description |
---|---|---|
Ordinate | ordinate | The ordinate index |
Returns
Type | Description |
---|---|
Double[] | An array of ordinate values |
HasNonEmptyElements(Geometry[])
Returns true if the array contains any non-empty Geometry
s.
Declaration
protected static bool HasNonEmptyElements(Geometry[] geometries)
Parameters
Type | Name | Description |
---|---|---|
Geometry[] | geometries | an array of |
Returns
Type | Description |
---|---|
Boolean |
|
HasNullElements(Object[])
Returns true if the array contains any null
elements.
Declaration
[Obsolete("Use HasNullElements<T>")]
public static bool HasNullElements(object[] array)
Parameters
Type | Name | Description |
---|---|---|
Object[] | array | an array to validate. |
Returns
Type | Description |
---|---|
Boolean |
|
HasNullElements<T>(IEnumerable<T>)
Returns true if the array contains any null
elements.
Declaration
public static bool HasNullElements<T>(IEnumerable<T> array)
where T : class
Parameters
Type | Name | Description |
---|---|---|
IEnumerable<T> | array | an array to validate. |
Returns
Type | Description |
---|---|
Boolean |
|
Type Parameters
Name | Description |
---|---|
T |
Intersection(Geometry)
Computes a Geometry
representing the point-set which is
common to both this Geometry
and the other
Geometry.
The intersection of two geometries of different dimension produces a result geometry of dimension less than or equal to the minimum dimension of the input geometries. The result geometry may be a heterogeneous GeometryCollection. If the result is empty, it is an atomic geometry with the dimension of the lowest input dimension.
Intersection of GeometryCollections is supported only for homogeneous collection types.
Non-empty heterogeneous GeometryCollection arguments are not supported.
Declaration
public Geometry Intersection(Geometry other)
Parameters
Type | Name | Description |
---|---|---|
Geometry | other | The |
Returns
Type | Description |
---|---|
Geometry | A geometry representing the point-set common to the two |
Exceptions
Type | Condition |
---|---|
TopologyException | if a robustness error occurs. |
ArgumentException | if the argument is a non-empty heterogeneous |
ArgumentException | if the argument has a factory with a different |
Intersects(Geometry)
Tests whether this geometry intersects the argument geometry.
Declaration
public virtual bool Intersects(Geometry g)
Parameters
Type | Name | Description |
---|---|---|
Geometry | g | The |
Returns
Type | Description |
---|---|
Boolean |
|
Remarks
The 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
[T********]
or
[*T*******]
or
[***T*****]
or
[****T****]
!g.disjoint(this)
(Intersects
is the inverse ofDisjoint
)
IsEquivalentClass(Geometry)
Returns whether the two Geometry
s are equal, from the point
of view of the EqualsExact
method. Called by EqualsExact
. In general, two Geometry
classes are considered to be
"equivalent" only if they are the same class. An exception is LineString
, which is considered to be equivalent to its subclasses.
Declaration
protected virtual bool IsEquivalentClass(Geometry other)
Parameters
Type | Name | Description |
---|---|---|
Geometry | other | The |
Returns
Type | Description |
---|---|
Boolean |
|
IsWithinDistance(Geometry, Double)
Tests whether the distance from this Geometry
to another is less than or equal to a specified value.
Declaration
public virtual bool IsWithinDistance(Geometry geom, double distance)
Parameters
Type | Name | Description |
---|---|---|
Geometry | geom | the Geometry to check the distance to. |
Double | distance | the distance value to compare. |
Returns
Type | Description |
---|---|
Boolean |
|
Normalize()
Converts this Geometry
to normal form (or canonical form ).
Declaration
public abstract void Normalize()
Remarks
Normal form is a unique representation for Geometry
s.
It can be used to test whether two Geometry
s are equal
in a way that is independent of the ordering of the coordinates within
them. Normal form equality is a stronger condition than topological
equality, but weaker than pointwise equality.
The definitions for normal form use the standard lexicographical ordering for coordinates. "Sorted in order of coordinates" means the obvious extension of this ordering to sequences of coordinates.
NOTE that this method mutates the value of this geometry in-place. If this is not safe and/or wanted, the geometry should be cloned prior to normalization.
Normalized()
Creates a new Geometry which is a normalized copy of this Geometry.
Declaration
public Geometry Normalized()
Returns
Type | Description |
---|---|
Geometry | A normalized copy of this geometry. |
See Also
| Improve this Doc View SourceOverlaps(Geometry)
Tests whether this geometry overlaps the specified geometry.
Declaration
public virtual bool Overlaps(Geometry g)
Parameters
Type | Name | Description |
---|---|---|
Geometry | g | The |
Returns
Type | Description |
---|---|
Boolean |
|
Remarks
The 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 two points or two surfaces) or[1*T***T**]
(for two curves)
false
.
Relate(Geometry)
Returns the DE-9IM intersection matrix for the two Geometry
s.
Declaration
public virtual IntersectionMatrix Relate(Geometry g)
Parameters
Type | Name | Description |
---|---|---|
Geometry | g | The |
Returns
Type | Description |
---|---|
IntersectionMatrix | A matrix describing the intersections of the interiors,
boundaries and exteriors of the two |
Relate(Geometry, String)
Tests whether the elements in the DE-9IM
IntersectionMatrix for the two Geometry
s match the elements in intersectionPattern
.
Declaration
public virtual bool Relate(Geometry g, string intersectionPattern)
Parameters
Type | Name | Description |
---|---|---|
Geometry | g | the |
String | intersectionPattern | the pattern against which to check the
intersection matrix for the two |
Returns
Type | Description |
---|---|
Boolean |
|
Remarks
The pattern is a 9-character string, with symbols drawn from the following set:
0 | (dimension 0) |
1 | (dimension 1) |
2 | (dimension 2) |
T | ( matches 0, 1 or 2) |
F | ( matches FALSE) |
* | ( matches any value) |
See Also
| Improve this Doc View SourceReverse()
Computes a new geometry which has all component coordinate sequences in reverse order (opposite orientation) to this one.
Declaration
public virtual Geometry Reverse()
Returns
Type | Description |
---|---|
Geometry | A reversed geometry |
Remarks
Don't override this function, implement ReverseInternal().
ReverseInternal()
The actual implementation of the Reverse() function
Declaration
protected virtual Geometry ReverseInternal()
Returns
Type | Description |
---|---|
Geometry | A reversed geometry |
Remarks
In JTS this function is abstract, but that would break binary compatibility of current version.
SymmetricDifference(Geometry)
Computes a Geometry
representing the closure of the point-set
which is the union of the points in this Geometry
which are not
contained in the other
Geometry,
with the points in the other
Geometry not contained in this
Geometry
.
If the result is empty, it is an atomic geometry
with the dimension of the highest input dimension.
Non-empty GeometryCollection arguments are not supported.
Declaration
public Geometry SymmetricDifference(Geometry other)
Parameters
Type | Name | Description |
---|---|---|
Geometry | other | The |
Returns
Type | Description |
---|---|
Geometry | a Geometry representing the point-set symmetric difference of this |
Exceptions
Type | Condition |
---|---|
ArgumentException | if the argument has a factory with a different |
ToBinary()
Returns the Well-known Binary representation of this Geometry
.
For a definition of the Well-known Binary format, see the OpenGIS Simple
Features Specification.
Declaration
public byte[] ToBinary()
Returns
Type | Description |
---|---|
Byte[] | The Well-known Binary representation of this |
ToGMLFeature()
Returns the feature representation as GML 2.1.1 XML document.
This XML document is based on Geometry.xsd
schema.
NO features or XLink are implemented here!
Declaration
public XmlReader ToGMLFeature()
Returns
Type | Description |
---|---|
XmlReader |
ToString()
Returns the Well-known Text representation of this Geometry
.
For a definition of the Well-known Text format, see the OpenGIS Simple
Features Specification.
Declaration
public override string ToString()
Returns
Type | Description |
---|---|
String | The Well-known Text representation of this |
Overrides
| Improve this Doc View SourceToText()
Returns the Well-known Text representation of this Geometry
.
For a definition of the Well-known Text format, see the OpenGIS Simple
Features Specification.
Declaration
public string ToText()
Returns
Type | Description |
---|---|
String | The Well-known Text representation of this |
Touches(Geometry)
Tests whether this geometry touches the argument geometry
Declaration
public virtual bool Touches(Geometry g)
Parameters
Type | Name | Description |
---|---|---|
Geometry | g | The |
Returns
Type | Description |
---|---|
Boolean |
|
Remarks
The 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*****
orF***T****
.
false
,
since points have only interiors.
This predicate is symmetric.
Union()
Computes the union of all the elements of this geometry.
Declaration
public Geometry Union()
Returns
Type | Description |
---|---|
Geometry |
Remarks
This method supports GeometryCollections (which the other overlay operations currently do not).
Exceptions
Type | Condition |
---|---|
TopologyException | Thrown if a robustness error occurs |
Union(Geometry)
Computes a Geometry
representing the point-set
which is contained in both this
Geometry
and the other
Geometry.
Declaration
public Geometry Union(Geometry other)
Parameters
Type | Name | Description |
---|---|---|
Geometry | other | the |
Returns
Type | Description |
---|---|
Geometry | A point-set combining the points of this |
Remarks
The method may be used on arguments of different dimension, but it does not support GeometryCollection arguments.
The union of two geometries of different dimension produces a result geometry of dimension equal to the maximum dimension of the input geometries. The result geometry may be a heterogeneous GeometryCollection. If the result is empty, it is an atomic geometry with the dimension of the highest input dimension.
Unioning LineStrings has the effect of noding and dissolving the input linework. In this context "noding" means that there will be a node or endpoint in the result for every endpoint or line segment crossing in the input. "Dissolving" means that any duplicate (i.e. coincident) line segments or portions of line segments will be reduced to a single line segment in the result. If merged linework is required, the LineMerger class can be used.
Non-empty GeometryCollection arguments are not supported.
Exceptions
Type | Condition |
---|---|
TopologyException | Thrown if a robustness error occurs |
ArgumentException | Thrown if either input is a non-empty GeometryCollection |
ArgumentException | if the argument has a factory with a different |
See Also
| Improve this Doc View SourceWithin(Geometry)
Tests whether this geometry is within the specified geometry.
Declaration
public bool Within(Geometry g)
Parameters
Type | Name | Description |
---|---|---|
Geometry | g | The |
Returns
Type | Description |
---|---|
Boolean |
|
Remarks
The 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***]
g.contains(this) == true
(Within
is the converse of Contains(Geometry))
An implication of the definition is that "The boundary of a geometry is not within the Polygon".
In other words, if a geometry A is a subset of the points in the boundary of a geometry B, A.within(B) == 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 behaviour but avoiding
this subtle limitation, see CoveredBy(Geometry).
Operators
| Improve this Doc View SourceEquality(Geometry, Geometry)
Declaration
public static bool operator ==(Geometry obj1, Geometry obj2)
Parameters
Type | Name | Description |
---|---|---|
Geometry | obj1 | |
Geometry | obj2 |
Returns
Type | Description |
---|---|
Boolean |
Inequality(Geometry, Geometry)
Declaration
public static bool operator !=(Geometry obj1, Geometry obj2)
Parameters
Type | Name | Description |
---|---|---|
Geometry | obj1 | |
Geometry | obj2 |
Returns
Type | Description |
---|---|
Boolean |