NetTopologySuite
 All Classes Namespaces Functions Variables Enumerations Enumerator Properties Pages
NetTopologySuite.Geometries.Geometry Class Referenceabstract

A representation of a planar, linear vector geometry. More...

Inheritance diagram for NetTopologySuite.Geometries.Geometry:
NetTopologySuite.Geometries.GeometryCollection NetTopologySuite.Geometries.LineString NetTopologySuite.Geometries.Point NetTopologySuite.Geometries.Polygon NetTopologySuite.Geometries.MultiLineString NetTopologySuite.Geometries.MultiPoint NetTopologySuite.Geometries.MultiPolygon NetTopologySuite.Geometries.LinearRing

Public Member Functions

abstract double[] GetOrdinates (Ordinate ordinate)
 Gets an array of System.Double ordinate values More...
 
virtual IGeometry GetGeometryN (int n)
 Returns an element Geometry from a GeometryCollection, or More...
 
double Distance (IGeometry g)
 Returns the minimum distance between this Geometry and another Geometry g. More...
 
bool IsWithinDistance (IGeometry geom, double distance)
 Tests whether the distance from this Geometry to another is less than or equal to a specified value. More...
 
void GeometryChanged ()
 Notifies this geometry that its coordinates have been changed by an external party (for example, via a ICoordinateFilter). More...
 
void 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. More...
 
bool Disjoint (IGeometry g)
 Tests whether this geometry is disjoint from the argument geometry. More...
 
bool Touches (IGeometry g)
 Tests whether this geometry touches the argument geometry More...
 
bool Intersects (IGeometry g)
 Tests whether this geometry intersects the argument geometry. /summary> More...
 
bool Crosses (IGeometry g)
 
bool Within (IGeometry g)
 Tests whether this geometry is within the specified geometry. More...
 
bool Contains (IGeometry g)
 
bool Overlaps (IGeometry g)
 Tests whether this geometry overlaps the specified geometry. More...
 
bool Covers (IGeometry g)
 Tests whether this geometry covers the argument geometry More...
 
bool CoveredBy (IGeometry g)
 
bool Relate (IGeometry g, string intersectionPattern)
 
IntersectionMatrix Relate (IGeometry g)
 Returns the DE-9IM intersection matrix for the two Geometrys. More...
 
bool Equals (IGeometry g)
 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

See also
EqualsTopologically

method, which has been named to clearly denote its functionality. This method should NOT be confused with the method

See also
Equals(Object)

, which implements an exact equality comparison. More...

 
bool EqualsTopologically (IGeometry g)
 Tests whether this geometry is topologically equal to the argument geometry as defined by the SFS Equals predicate. More...
 
override bool Equals (Object o)
 Tests whether this geometry is structurally and numerically equal to a given Object. More...
 
override int GetHashCode ()
 Gets a hash code for the Geometry. More...
 
override string 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. More...
 
string ToText ()
 Returns the Well-known Text representation of this Geometry. For a definition of the Well-known Text format, see the OpenGIS Simple Features Specification. More...
 
string AsText ()
 ToText More...
 
byte[] 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. More...
 
byte[] AsBinary ()
 ToBinary More...
 
XmlReader 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! More...
 
IGeometry Buffer (double distance)
 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). More...
 
IGeometry Buffer (double distance, BufferStyle 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). More...
 
IGeometry Buffer (double distance, EndCapStyle 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). More...
 
IGeometry Buffer (double distance, int quadrantSegments)
 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. More...
 
IGeometry Buffer (double distance, int quadrantSegments, BufferStyle 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. More...
 
IGeometry Buffer (double distance, int quadrantSegments, EndCapStyle 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. More...
 
IGeometry Buffer (double distance, IBufferParameters 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. More...
 
virtual IGeometry 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. More...
 
abstract IGeometry Reverse ()
 
IGeometry Intersection (IGeometry other)
 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 heterogenous IGeometryCollection. If the result is empty, it is an atomic geometry with the dimension of the lowest input dimension. Intersection of IGeometryCollections is supported only for homogeneous collection types. Non-empty heterogeneous IGeometryCollection arguments are not supported. More...
 
IGeometry Union (IGeometry other)
 Computes a Geometry representing the point-set which is contained in both this Geometry and the other Geometry. More...
 
IGeometry Difference (IGeometry other)
 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 IGeometryCollection arguments are not supported. More...
 
IGeometry SymmetricDifference (IGeometry other)
 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 IGeometryCollection arguments are not supported. More...
 
IGeometry Union ()
 Computes the union of all the elements of this geometry. More...
 
abstract bool EqualsExact (IGeometry other, double tolerance)
 Returns true if the two Geometrys 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.

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. More...

 
bool EqualsExact (IGeometry other)
 Returns true if the two Geometrys 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 provides a stricter test of equality than EqualsTopologically, which is more useful in certain situations (such as using geometries as keys in collections). 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. More...

 
bool EqualsNormalized (IGeometry g)
 Tests whether two geometries are exactly equal in their normalized forms. More...
 
abstract void Apply (ICoordinateFilter filter)
 Performs an operation with or on this Geometry's coordinates. More...
 
abstract void Apply (ICoordinateSequenceFilter filter)
 
abstract void Apply (IGeometryFilter filter)
 Performs an operation with or on this Geometry and its subelement Geometrys (if any). Only GeometryCollections and subclasses have subelement Geometry's. More...
 
abstract void Apply (IGeometryComponentFilter filter)
 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. More...
 
virtual object Clone ()
 
abstract void Normalize ()
 Converts this Geometry to normal form (or canonical form ). More...
 
IGeometry Normalized ()
 Creates a new Geometry which is a normalized copy of this Geometry. More...
 
int CompareTo (object o)
 Returns whether this Geometry is greater than, equal to, or less than another Geometry. More...
 
int CompareTo (IGeometry geom)
 Returns whether this Geometry is greater than, equal to, or less than another Geometry. More...
 
int CompareTo (Object o, IComparer< ICoordinateSequence > comp)
 Returns whether this Geometry is greater than, equal to, or less than another Geometry, using the given . More...
 

Static Public Member Functions

static bool HasNullElements (object[] array)
 Returns true if the array contains any null elements. More...
 
static bool operator== (Geometry obj1, IGeometry obj2)
 
static bool operator!= (Geometry obj1, IGeometry obj2)
 

Static Public Attributes

static readonly IGeometryFactory DefaultFactory = GeometryFactory.Default
 A predefined GeometryFactory with PrecisionModel == PrecisionModels.Fixed. More...
 

Protected Member Functions

 Geometry (IGeometryFactory factory)
 Creates a new Geometry via the specified GeometryFactory. More...
 
virtual bool IsEquivalentClass (IGeometry other)
 Returns whether the two Geometrys 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. More...
 
void CheckNotGeometryCollection (IGeometry g)
 Throws an exception if g's class is GeometryCollection. (its subclasses do not trigger an exception). More...
 
abstract Envelope 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. More...
 

Static Protected Member Functions

static bool HasNonEmptyElements (IGeometry[] geometries)
 Returns true if the array contains any non-empty Geometrys. More...
 
static int Compare (List< IGeometry > a, List< IGeometry > b)
 Returns the first non-zero result of CompareTo encountered as the two Collections 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. More...
 
static bool Equal (Coordinate a, Coordinate b, double tolerance)
 
static double[] CreateArray (int size, double value)
 
static double[] CreateArray (ICoordinateSequence sequence, Ordinate ordinate)
 

Properties

IGeometryFactory Factory [get]
 Gets the factory which contains the context in which this point was created. More...
 
object UserData [get, set]
 Gets/Sets the user data object for this point, if any. More...
 
int SRID [get, set]
 Sets the ID of the Spatial Reference System used by the Geometry. More...
 
abstract string GeometryType [get]
 Returns the name of this Geometry's actual class. More...
 
abstract OgcGeometryType OgcGeometryType [get]
 Gets the OGC geometry type More...
 
IPrecisionModel PrecisionModel [get]
 Returns the PrecisionModel used by the Geometry. More...
 
abstract Coordinate Coordinate [get]
 Returns a vertex of this Geometry (usually, but not necessarily, the first one). More...
 
abstract Coordinate[] Coordinates [get]
 Returns an array containing the values of all the vertices for this geometry. More...
 
abstract int NumPoints [get]
 Returns the count of this Geometrys vertices. The Geometry s contained by composite Geometrys must be Geometry's; that is, they must implement NumPoints. More...
 
virtual int NumGeometries [get]
 Returns the number of Geometryes in a GeometryCollection, or 1, if the geometry is not a collection. More...
 
bool IsSimple [get]
 Tests whether this IGeometry 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 IGeometry subclass as follows:

  • Valid polygonal geometries are simple, since their rings must not self-intersect. IsSimple tests for this condition and reports
More...
 
virtual bool IsValid [get]
 Tests whether this Geometry is topologically valid, according to the OGC SFS specification.For validity rules see the documentation for the specific geometry subclass. More...
 
abstract bool IsEmpty [get]
 Tests whether the set of points covered in this Geometry is empty. More...
 
virtual double Area [get]
 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 More...
 
virtual double Length [get]
 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 More...
 
IPoint Centroid [get]
 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. More...
 
IPoint InteriorPoint [get]
 Computes an interior point of this Geometry. More...
 
IPoint PointOnSurface [get]
 InteriorPoint More...
 
virtual Dimension Dimension [get, set]
 Returns the dimension of this geometry. More...
 
virtual IGeometry Boundary [get, set]
 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." More...
 
virtual Dimension BoundaryDimension [get, set]
 Returns the dimension of this Geometrys inherent boundary. More...
 
IGeometry Envelope [get]
 Gets a geometry representing the envelope (bounding box) of this Geometry. More...
 
Envelope EnvelopeInternal [get]
 Gets an GeoAPI.Geometries.Envelope containing the minimum and maximum x and y values in this Geometry. If the geometry is empty, an empty Envelope is returned. More...
 
bool IsGeometryCollection [get]
 
virtual bool IsRectangle [get]
 

Detailed Description

A representation of a planar, linear vector geometry.

Binary Predicates:

Because it is not clear at this time what semantics for spatial analysis methods involving GeometryCollections would be useful, GeometryCollections 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, a Point, 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 Geometrys 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 LineStrings. It means that all intersection points on LineStrings will be present as endpoints of LineStrings 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 Geometrys. These new points arise from intersections between line segments in the edges of the input Geometrys. 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(IGeometry) 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(IGeometry) is provided as a convenience method to compute equality over normalized geometries, but it is expensive to use. Finally, EqualsExact(IGeometry, double) allows using a tolerance value for point comparison.

Topological Equality

Topological Equality is provided by the EqualsTopologically(IGeometry) 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(IGeometry) 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.

Constructor & Destructor Documentation

NetTopologySuite.Geometries.Geometry.Geometry ( IGeometryFactory  factory)
protected

Creates a new Geometry via the specified GeometryFactory.

Parameters
factoryThe factory

Member Function Documentation

abstract void NetTopologySuite.Geometries.Geometry.Apply ( ICoordinateFilter  filter)
pure virtual

Performs an operation with or on this Geometry's coordinates.

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).

Parameters
filterThe filter to apply to this Geometry's coordinates

summary> Performs an operation on the coordinates in this Geometry's ICoordinateSequences.

If the filter reports that a coordinate value has been changed, GeometryChanged will be called automatically. /remarks>

Parameters
filterThe filter to apply

Implemented in NetTopologySuite.Geometries.Polygon, NetTopologySuite.Geometries.LineString, NetTopologySuite.Geometries.GeometryCollection, and NetTopologySuite.Geometries.Point.

abstract void NetTopologySuite.Geometries.Geometry.Apply ( IGeometryFilter  filter)
pure virtual

Performs an operation with or on this Geometry and its subelement Geometrys (if any). Only GeometryCollections and subclasses have subelement Geometry's.

Parameters
filterThe filter to apply to this Geometry (and its children, if it is a GeometryCollection).

Implemented in NetTopologySuite.Geometries.Polygon, NetTopologySuite.Geometries.LineString, NetTopologySuite.Geometries.GeometryCollection, and NetTopologySuite.Geometries.Point.

abstract void NetTopologySuite.Geometries.Geometry.Apply ( IGeometryComponentFilter  filter)
pure virtual

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.

Parameters
filterThe filter to apply to this Geometry.

Implemented in NetTopologySuite.Geometries.Polygon, NetTopologySuite.Geometries.LineString, NetTopologySuite.Geometries.GeometryCollection, and NetTopologySuite.Geometries.Point.

byte [] NetTopologySuite.Geometries.Geometry.AsBinary ( )

ToBinary

Returns
string NetTopologySuite.Geometries.Geometry.AsText ( )

ToText

Returns
IGeometry NetTopologySuite.Geometries.Geometry.Buffer ( double  distance)

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).

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 BufferStyle.CapRound.

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.

Parameters
distanceThe width of the buffer (may be positive, negative or 0), interpreted according to the PrecisionModel of the Geometry.
Returns
a polygonal geometry representing the buffer region (which may be empty)
Exceptions
TopologyExceptionIf a robustness error occurs
See also
Buffer(double, EndCapStyle), Buffer(double, IBufferParameters), Buffer(double, int), Buffer(double, int, EndCapStyle)
IGeometry NetTopologySuite.Geometries.Geometry.Buffer ( double  distance,
BufferStyle  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).

The end cap style specifies the buffer geometry that will be created at the ends of linestrings. The styles provided are:

  • BufferStyle.CapRound - (default) a semi-circle
  • BufferStyle.CapButt - a straight line perpendicular to the end segment
  • BufferStyle.CapSquare - 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.

Parameters
distanceThe width of the buffer, interpreted according to the PrecisionModel of the Geometry.
endCapStyleCap Style to use for compute buffer.
Returns
a polygonal geometry representing the buffer region (which may be empty)
Exceptions
TopologyExceptionIf a robustness error occurs
See also
Buffer(double), Buffer(double, EndCapStyle), Buffer(double, IBufferParameters), Buffer(double, int), Buffer(double, int, BufferStyle), Buffer(double, int, EndCapStyle)
IGeometry NetTopologySuite.Geometries.Geometry.Buffer ( double  distance,
EndCapStyle  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).

The end cap style specifies the buffer geometry that will be created at the ends of linestrings. The styles provided are:

  • EndCapStyle.Round - (default) a semi-circle
  • EndCapStyle.Flat - a straight line perpendicular to the end segment
  • EndCapStyle.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.

Parameters
distanceThe width of the buffer, interpreted according to the PrecisionModel of the Geometry.
endCapStyleCap Style to use for compute buffer.
Returns
a polygonal geometry representing the buffer region (which may be empty)
Exceptions
TopologyExceptionIf a robustness error occurs
See also
Buffer(double), Buffer(double, IBufferParameters), Buffer(double, int), Buffer(double, int, EndCapStyle)
IGeometry NetTopologySuite.Geometries.Geometry.Buffer ( double  distance,
int  quadrantSegments 
)

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.

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.

Parameters
distanceThe width of the buffer (may be positive, negative or 0), interpreted according to the PrecisionModel of the Geometry.
quadrantSegmentsThe number of segments to use to approximate a quadrant of a circle.
Returns
a polygonal geometry representing the buffer region (which may be empty)
Exceptions
TopologyExceptionIf a robustness error occurs
See also
Buffer(double), Buffer(double, EndCapStyle), Buffer(double, IBufferParameters), Buffer(double, int, EndCapStyle)
IGeometry NetTopologySuite.Geometries.Geometry.Buffer ( double  distance,
int  quadrantSegments,
BufferStyle  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.

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:

  • BufferStyle.CapRound - (default) a semi-circle
  • BufferStyle.CapButt - a straight line perpendicular to the end segment
  • BufferStyle.CapSquare - 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.

Parameters
distanceThe width of the buffer, interpreted according to the PrecisionModel of the Geometry.
quadrantSegmentsThe number of segments to use to approximate a quadrant of a circle.
endCapStyleCap Style to use for compute buffer.
Returns
a polygonal geometry representing the buffer region (which may be empty)
Exceptions
TopologyExceptionIf a robustness error occurs
See also
Buffer(double), Buffer(double, BufferStyle), Buffer(double, EndCapStyle), Buffer(double, IBufferParameters), Buffer(double, int), Buffer(double, int, EndCapStyle)
IGeometry NetTopologySuite.Geometries.Geometry.Buffer ( double  distance,
int  quadrantSegments,
EndCapStyle  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.

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:

  • EndCapStyle.Round - (default) a semi-circle
  • EndCapStyle.Flat - a straight line perpendicular to the end segment
  • EndCapStyle.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.

Parameters
distanceThe width of the buffer, interpreted according to the PrecisionModel of the Geometry.
quadrantSegmentsThe number of segments to use to approximate a quadrant of a circle.
endCapStyleCap Style to use for compute buffer.
Returns
a polygonal geometry representing the buffer region (which may be empty)
Exceptions
TopologyExceptionIf a robustness error occurs
See also
Buffer(double), Buffer(double, EndCapStyle), Buffer(double, IBufferParameters), Buffer(double, int)
IGeometry NetTopologySuite.Geometries.Geometry.Buffer ( double  distance,
IBufferParameters  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.

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:

  • EndCapStyle.Round - (default) a semi-circle
  • EndCapStyle.Flat - a straight line perpendicular to the end segment
  • EndCapStyle.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.

Parameters
distanceThe width of the buffer, interpreted according to the PrecisionModel of the Geometry.
bufferParametersThis argument type has a number of properties that control the construction of the buffer, including QuadrantSegments, EndCapStyle, JoinStyle, and MitreLimit
Returns
a polygonal geometry representing the buffer region (which may be empty)
Exceptions
TopologyExceptionIf a robustness error occurs
See also
Buffer(double), Buffer(double, BufferStyle), Buffer(double, EndCapStyle), Buffer(double, int), Buffer(double, int, BufferStyle), Buffer(double, int, EndCapStyle)
void NetTopologySuite.Geometries.Geometry.CheckNotGeometryCollection ( IGeometry  g)
protected

Throws an exception if g's class is GeometryCollection. (its subclasses do not trigger an exception).

Parameters
gThe Geometry to check.
Exceptions
ArgumentExceptionif g is a GeometryCollection, but not one of its subclasses.
virtual object NetTopologySuite.Geometries.Geometry.Clone ( )
virtual
static int NetTopologySuite.Geometries.Geometry.Compare ( List< IGeometry >  a,
List< IGeometry >  b 
)
staticprotected

Returns the first non-zero result of CompareTo encountered as the two Collections 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.

Parameters
aA Collection of IComparables.
bA Collection of IComparables.
Returns
The first non-zero compareTo result, if any; otherwise, zero.
int NetTopologySuite.Geometries.Geometry.CompareTo ( object  o)

Returns whether this Geometry is greater than, equal to, or less than another Geometry.

If their classes are different, they are compared using the following ordering:

If the two Geometrys have the same class, their first elements are compared. If those are the same, the second elements are compared, etc.

Parameters
oA Geometry with which to compare this Geometry
Returns
A positive number, 0, or a negative number, depending on whether this object is greater than, equal to, or less than o, as defined in "Normal Form For Geometry" in the NTS Technical Specifications.
int NetTopologySuite.Geometries.Geometry.CompareTo ( IGeometry  geom)

Returns whether this Geometry is greater than, equal to, or less than another Geometry.

If their classes are different, they are compared using the following ordering:

If the two Geometrys have the same class, their first elements are compared. If those are the same, the second elements are compared, etc.

Parameters
geomA Geometry with which to compare this Geometry
Returns
A positive number, 0, or a negative number, depending on whether this object is greater than, equal to, or less than o, as defined in "Normal Form For Geometry" in the NTS Technical Specifications.
int NetTopologySuite.Geometries.Geometry.CompareTo ( Object  o,
IComparer< ICoordinateSequence >  comp 
)

Returns whether this Geometry is greater than, equal to, or less than another Geometry, using the given .

If their classes are different, they are compared using the following ordering:

If the two Geometrys have the same class, their first elements are compared. If those are the same, the second elements are compared, etc.

Parameters
oA Geometry with which to compare this Geometry
compA IComparer<ICoordinateSequence>
Returns
A positive number, 0, or a negative number, depending on whether this object is greater than, equal to, or less than o, as defined in "Normal Form For Geometry" in the NTS Technical Specifications.
abstract Envelope NetTopologySuite.Geometries.Geometry.ComputeEnvelopeInternal ( )
protectedpure virtual

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.

Returns
This Geometrys bounding box; if the Geometry is empty, Envelope.IsNull will return true.

Implemented in NetTopologySuite.Geometries.GeometryCollection, NetTopologySuite.Geometries.Polygon, NetTopologySuite.Geometries.LineString, and NetTopologySuite.Geometries.Point.

bool NetTopologySuite.Geometries.Geometry.Contains ( IGeometry  g)
Parameters
gthe Geometry with which to compare this Geometry
Returns
true if this Geometry contains g

Within Covers

virtual IGeometry NetTopologySuite.Geometries.Geometry.ConvexHull ( )
virtual

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.

Returns
the minimum-area convex polygon containing this Geometry's points.

summary> Computes a new geometry which has all component coordinate sequences in reverse order (opposite orientation) to this one. /summary>

Returns
A reversed geometry

Reimplemented in NetTopologySuite.Geometries.Polygon.

bool NetTopologySuite.Geometries.Geometry.CoveredBy ( IGeometry  g)

summary> Tests whether the elements in the DE-9IM IntersectionMatrix for the two Geometrys match the elements in intersectionPattern.

The pattern is a 9-character string, with symbols drawn from the following set:

>0 (dimension 0) item>1 (dimension 1) item>2 (dimension 2) item>T ( matches 0, 1 or 2) item>F ( matches FALSE) item>* ( matches any value)

For more information on the DE-9IM, see the OpenGIS Simple Features Specification.

Parameters
gthe Geometry with which to compare this Geometry
intersectionPatternthe pattern against which to check the intersection matrix for the two Geometrys
Returns
true if the DE-9IM intersection matrix for the two Geometrys match intersectionPattern
See also
IntersectionMatrix
bool NetTopologySuite.Geometries.Geometry.Covers ( IGeometry  g)

Tests whether this geometry covers the argument geometry

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*]
  • g.CoveredBy(this) == true
    (covers is the converse of CoveredBy)

If either geometry is empty, the value of this predicate is 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 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.

Parameters
gThe Geometry with which to compare this Geometry
Returns
true if this Geometry covers g
See also
Contains, CoveredBy

summary>Tests whether this geometry is covered by the specified geometry.

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)

If either geometry is empty, the value of this predicate is false.

This predicate is similar to Within, but is more inclusive (i.e. returns true for more cases).

/remarks> param name="g">the Geometry with which to compare this Geometry

returns>true if this Geometry is covered by g

seealso cref="Within"/> seealso cref="Covers"/>

IGeometry NetTopologySuite.Geometries.Geometry.Difference ( IGeometry  other)

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 IGeometryCollection arguments are not supported.

Parameters
otherThe Geometry with which to compute the difference.
Returns
A Geometry representing the point-set difference of this Geometry with other.
bool NetTopologySuite.Geometries.Geometry.Disjoint ( IGeometry  g)

Tests whether this geometry is disjoint from the argument geometry.

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 of Intersects)
Parameters
gThe Geometry with which to compare this Geometry.
Returns
true if the two Geometrys are disjoint.

Intersects

double NetTopologySuite.Geometries.Geometry.Distance ( IGeometry  g)

Returns the minimum distance between this Geometry and another Geometry g.

Parameters
gThe Geometry from which to compute the distance.
Returns

The distance between the geometries

0 if either input geometry is empty

Exceptions
ArgumentExceptionif g is null
static bool NetTopologySuite.Geometries.Geometry.Equal ( Coordinate  a,
Coordinate  b,
double  tolerance 
)
staticprotected

Parameters
a
b
tolerance
Returns
bool NetTopologySuite.Geometries.Geometry.Equals ( IGeometry  g)

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

See also
EqualsTopologically

method, which has been named to clearly denote its functionality. This method should NOT be confused with the method

See also
Equals(Object)

, which implements an exact equality comparison.

Parameters
gThe Geometry with which to compare this Geometry
Returns
true if the two Geometrys are topologically equal.
See also
EqualsTopologically
override bool NetTopologySuite.Geometries.Geometry.Equals ( Object  o)

Tests whether this geometry is structurally and numerically equal to a given Object.

If the argument Object is not a Geometry, the result is false. Otherwise, the result is computed using

See also
EqualsExact(IGeometry)

.

This method is provided to fulfill the Java contract for value-based object equality. In conjunction with

See also
GetHashCode

it provides semantics which are most useful for using Geometrys 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

See also
Normalized, Normalize

or as appropriate).

Parameters
oThe object to compare
Returns
true if this geometry is exactly equal to the argument
See also
EqualsExact(IGeometry), GetHashCode, Normalized, Normalize
abstract bool NetTopologySuite.Geometries.Geometry.EqualsExact ( IGeometry  other,
double  tolerance 
)
pure virtual

Returns true if the two Geometrys 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.

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.

Parameters
otherThe Geometry with which to compare this Geometry have identical structure and point values, up to the distance tolerance.
toleranceDistance at or below which two Coordinates will be considered equal.
Returns
true if this and the other Geometry are of the same class and have equal internal data.
See also
EqualsExact(IGeometry), Normalize, Normalized

Implemented in NetTopologySuite.Geometries.Polygon, NetTopologySuite.Geometries.LineString, NetTopologySuite.Geometries.GeometryCollection, NetTopologySuite.Geometries.Point, NetTopologySuite.Geometries.MultiLineString, NetTopologySuite.Geometries.MultiPolygon, and NetTopologySuite.Geometries.MultiPoint.

bool NetTopologySuite.Geometries.Geometry.EqualsExact ( IGeometry  other)

Returns true if the two Geometrys 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 provides a stricter test of equality than EqualsTopologically, which is more useful in certain situations (such as using geometries as keys in collections). 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.

Parameters
otherThe Geometry with which to compare this Geometry.
Returns
true if this and the other Geometry have identical structure and point values.
bool NetTopologySuite.Geometries.Geometry.EqualsNormalized ( IGeometry  g)

Tests whether two geometries are exactly equal in their normalized forms.

This is a convenience method which creates normalized versions of both geometries before computing

See also
EqualsExact(IGeometry)

.

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.

Parameters
gA geometry
Returns
true if the input geometries are exactly equal in their normalized form
See also
EqualsExact(IGeometry)
bool NetTopologySuite.Geometries.Geometry.EqualsTopologically ( IGeometry  g)

Tests whether this geometry is topologically equal to the argument geometry as defined by the SFS Equals predicate.

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*
    

Note that this method computes topologically equality. For structural equality, see equalsExact(Geometry).

Parameters
gthe Geometry with which to compare this Geometry
Returns
true if the two s are topologically equal
void NetTopologySuite.Geometries.Geometry.GeometryChanged ( )

Notifies this geometry that its coordinates have been changed by an external party (for example, via a ICoordinateFilter).

When this method is called the geometry will flush and/or update any derived information it has cached (such as its GeoAPI.Geometries.Envelope ). The operation is applied to all component Geometries.

void NetTopologySuite.Geometries.Geometry.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.

virtual IGeometry NetTopologySuite.Geometries.Geometry.GetGeometryN ( int  n)
virtual

Returns an element Geometry from a GeometryCollection, or

this, if the geometry is not a collection.

Parameters
nThe index of the geometry element.
Returns
The n'th geometry contained in this geometry.

Reimplemented in NetTopologySuite.Geometries.GeometryCollection.

override int NetTopologySuite.Geometries.Geometry.GetHashCode ( )

Gets a hash code for the Geometry.

Returns
An integer value suitable for use as a hashcode
abstract double [] NetTopologySuite.Geometries.Geometry.GetOrdinates ( Ordinate  ordinate)
pure virtual

Gets an array of System.Double ordinate values

Parameters
ordinateThe ordinate index
Returns
An array of ordinate values

Implemented in NetTopologySuite.Geometries.Polygon, NetTopologySuite.Geometries.GeometryCollection, NetTopologySuite.Geometries.Point, and NetTopologySuite.Geometries.LineString.

static bool NetTopologySuite.Geometries.Geometry.HasNonEmptyElements ( IGeometry[]  geometries)
staticprotected

Returns true if the array contains any non-empty Geometrys.

Parameters
geometriesan array of Geometrys; no elements may be null
Returns
true if any of the Geometrys IsEmpty methods return false.
static bool NetTopologySuite.Geometries.Geometry.HasNullElements ( object[]  array)
static

Returns true if the array contains any null elements.

Parameters
arrayan array to validate.
Returns
true if any of arrays elements are null.
IGeometry NetTopologySuite.Geometries.Geometry.Intersection ( IGeometry  other)

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 heterogenous IGeometryCollection. If the result is empty, it is an atomic geometry with the dimension of the lowest input dimension. Intersection of IGeometryCollections is supported only for homogeneous collection types. Non-empty heterogeneous IGeometryCollection arguments are not supported.

Parameters
otherThe Geometry with which to compute the intersection.
Returns
A geometry representing the point-set common to the two Geometrys.
Exceptions
TopologyExceptionif a robustness error occurs.
ArgumentExceptionif the argument is a non-empty heterogenous GeometryCollection
bool NetTopologySuite.Geometries.Geometry.Intersects ( IGeometry  g)

Tests whether this geometry intersects the argument geometry. /summary>

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 of Disjoint)
Parameters
gThe Geometry with which to compare this Geometry.
Returns
true if the two Geometrys intersect.

Disjoint summary> Tests whether this geometry crosses the specified geometry. /summary>

The 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:
  • CodeDescription
  • [T*T******]for P/L, P/A, and L/A situations
  • [T*****T**]for L/P, A/P, and A/L situations)
  • [0********]for L/L situations

For any other combination of dimensions this predicate returns

false

.

The SFS defined this predicate only for P/L, P/A, L/L, and L/A situations. In order to make the relation symmetric, NTS extends the definition to apply to L/P, A/P and A/L situations as well.

Parameters
gThe Geometry with which to compare this Geometry
Returns
true if the two Geometrys cross.
virtual bool NetTopologySuite.Geometries.Geometry.IsEquivalentClass ( IGeometry  other)
protectedvirtual

Returns whether the two Geometrys 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.

Parameters
otherThe Geometry with which to compare this Geometry for equality.
Returns
true if the classes of the two Geometry s are considered to be equal by the equalsExact method.

Reimplemented in NetTopologySuite.Geometries.LineString.

bool NetTopologySuite.Geometries.Geometry.IsWithinDistance ( IGeometry  geom,
double  distance 
)

Tests whether the distance from this Geometry to another is less than or equal to a specified value.

Parameters
geomthe Geometry to check the distance to.
distancethe distance value to compare.
Returns
true if the geometries are less than distance apart.
abstract void NetTopologySuite.Geometries.Geometry.Normalize ( )
pure virtual

Converts this Geometry to normal form (or canonical form ).

Normal form is a unique representation for Geometrys. It can be used to test whether two Geometrys 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.

Implemented in NetTopologySuite.Geometries.Polygon, NetTopologySuite.Geometries.LineString, NetTopologySuite.Geometries.GeometryCollection, and NetTopologySuite.Geometries.Point.

IGeometry NetTopologySuite.Geometries.Geometry.Normalized ( )

Creates a new Geometry which is a normalized copy of this Geometry.

Returns
A normalized copy of this geometry.
See also
Normalize
static bool NetTopologySuite.Geometries.Geometry.operator!= ( Geometry  obj1,
IGeometry  obj2 
)
static

Parameters
obj1
obj2
Returns
static bool NetTopologySuite.Geometries.Geometry.operator== ( Geometry  obj1,
IGeometry  obj2 
)
static

Parameters
obj1
obj2
Returns
bool NetTopologySuite.Geometries.Geometry.Overlaps ( IGeometry  g)

Tests whether this geometry overlaps the specified geometry.

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)

If the geometries are of different dimension this predicate returns false.

Parameters
gThe Geometry with which to compare this Geometry.
Returns
true if the two Geometrys overlap. For this function to return true, the Geometry s must be two points, two curves or two surfaces.
IntersectionMatrix NetTopologySuite.Geometries.Geometry.Relate ( IGeometry  g)

Returns the DE-9IM intersection matrix for the two Geometrys.

Parameters
gThe Geometry with which to compare this Geometry
Returns
A matrix describing the intersections of the interiors, boundaries and exteriors of the two Geometrys.
IGeometry NetTopologySuite.Geometries.Geometry.SymmetricDifference ( IGeometry  other)

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 IGeometryCollection arguments are not supported.

Parameters
otherThe Geometry with which to compute the symmetric difference.
Returns
a Geometry representing the point-set symmetric difference of this Geometry with other.
byte [] NetTopologySuite.Geometries.Geometry.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.

Returns
The Well-known Binary representation of this Geometry.
XmlReader NetTopologySuite.Geometries.Geometry.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!

override string NetTopologySuite.Geometries.Geometry.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.

Returns
The Well-known Text representation of this Geometry.
string NetTopologySuite.Geometries.Geometry.ToText ( )

Returns the Well-known Text representation of this Geometry. For a definition of the Well-known Text format, see the OpenGIS Simple Features Specification.

Returns
The Well-known Text representation of this Geometry.
bool NetTopologySuite.Geometries.Geometry.Touches ( IGeometry  g)

Tests whether this geometry touches the argument geometry

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***** or
    • F***T****.

If both geometries have dimension 0, the predicate returns false, since points have only interiors. This predicate is symmetric.

Parameters
gThe Geometry with which to compare this Geometry.
Returns
true if the two Geometrys touch; Returns false if both Geometrys are points.
IGeometry NetTopologySuite.Geometries.Geometry.Union ( IGeometry  other)

Computes a Geometry representing the point-set which is contained in both this Geometry and the other Geometry.

The method may be used on arguments of different dimension, but it does not support IGeometryCollection 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 heterogenous IGeometryCollection. If the result is empty, it is an atomic geometry with the dimension of the highest input dimension.

Unioning ILineStrings 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 IGeometryCollection arguments are not supported.

Parameters
otherthe Geometry with which to compute the union
Returns
A point-set combining the points of this Geometry and the points of other
Exceptions
TopologyExceptionThrown if a robustness error occurs
ArgumentExceptionThrown if either input is a non-empty GeometryCollection
See also
LineMerger
IGeometry NetTopologySuite.Geometries.Geometry.Union ( )

Computes the union of all the elements of this geometry.

This method supports IGeometryCollections (which the other overlay operations currently do not).

The result obeys the following contract:

  • Unioning a set of ILineStrings has the effect of fully noding and dissolving the linework.
  • Unioning a set of IPolygons always returns a IPolygonal geometry (unlike Union(IGeometry)), which may return geometries of lower dimension if a topology collapse occurred).
Exceptions
TopologyExceptionThrown if a robustness error occurs
bool NetTopologySuite.Geometries.Geometry.Within ( IGeometry  g)

Tests whether this geometry is within the specified geometry.

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)

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.

Parameters
gThe Geometry with which to compare this Geometry.
Returns
true if this Geometry is within other.

Contains CoveredBy summary> Tests whether this geometry contains the argument geometry.

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)

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.

Member Data Documentation

readonly IGeometryFactory NetTopologySuite.Geometries.Geometry.DefaultFactory = GeometryFactory.Default
static

A predefined GeometryFactory with PrecisionModel == PrecisionModels.Fixed.

See also
GeometryFactory.Default, GeometryFactory.Fixed

Property Documentation

virtual double NetTopologySuite.Geometries.Geometry.Area
get

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

Returns
The area of the Geometry.
virtual IGeometry NetTopologySuite.Geometries.Geometry.Boundary
getset

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."

Returns
The closure of the combinatorial boundary of this Geometry.

NOTE: make abstract, remove setter and change geoapi

virtual Dimension NetTopologySuite.Geometries.Geometry.BoundaryDimension
getset

Returns the dimension of this Geometrys inherent boundary.

Returns
The dimension of the boundary of the class implementing this interface, whether or not this object is the empty point. Returns Dimension.False if the boundary is the empty point.

NOTE: make abstract, remove setter and change geoapi

IPoint NetTopologySuite.Geometries.Geometry.Centroid
get

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.

Returns
A Point which is the centroid of this Geometry.
abstract Coordinate NetTopologySuite.Geometries.Geometry.Coordinate
get

Returns a vertex of this Geometry (usually, but not necessarily, the first one).

The returned coordinate should not be assumed to be an actual Coordinate object used in the internal representation.

Returns

a Coordinate which is a vertex of this Geometry.

null if this Geometry is empty.

abstract Coordinate [] NetTopologySuite.Geometries.Geometry.Coordinates
get

Returns an array containing the values of all the vertices for this geometry.

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 ICoordinateSequence.SetOrdinate method (possibly on the components) to modify the underlying data. If the coordinates are modified, IGeometry.GeometryChanged must be called afterwards.

Returns
The vertices of this Geometry.
See also
IGeometry.GeometryChanged, ICoordinateSequence.SetOrdinate
virtual Dimension NetTopologySuite.Geometries.Geometry.Dimension
getset

Returns the dimension of this geometry.

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).

Returns
The topological dimensions of this geometry
IGeometry NetTopologySuite.Geometries.Geometry.Envelope
get

Gets a geometry representing the envelope (bounding box) of this Geometry.

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).
Returns
A Geometry representing the envelope of this Geometry
See also
IGeometryFactory.ToGeometry(GeoAPI.Geometries.Envelope)
Envelope NetTopologySuite.Geometries.Geometry.EnvelopeInternal
get

Gets an GeoAPI.Geometries.Envelope containing the minimum and maximum x and y values in this Geometry. If the geometry is empty, an empty Envelope is returned.

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.

Returns

the envelope of this Geometry.

An empty Envelope if this Geometry is empty

IGeometryFactory NetTopologySuite.Geometries.Geometry.Factory
get

Gets the factory which contains the context in which this point was created.

Returns
The factory for this point.
abstract string NetTopologySuite.Geometries.Geometry.GeometryType
get

Returns the name of this Geometry's actual class.

Returns
The name of this Geometrys actual class.
IPoint NetTopologySuite.Geometries.Geometry.InteriorPoint
get

Computes an interior point of this Geometry.

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.

Returns
A Point which is in the interior of this Geometry.
abstract bool NetTopologySuite.Geometries.Geometry.IsEmpty
get

Tests whether the set of points covered in this Geometry is empty.

Returns
true if this Geometry does not cover any points.
virtual bool NetTopologySuite.Geometries.Geometry.IsRectangle
get

Returns
bool NetTopologySuite.Geometries.Geometry.IsSimple
get

Tests whether this IGeometry 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 IGeometry subclass as follows:

  • Valid polygonal geometries are simple, since their rings must not self-intersect. IsSimple tests for this condition and reports

false if it is not met. (This is a looser test than checking for validity). Linear rings have the same semantics. Linear geometries are simple iff they do not self-intersect at points other than boundary points. Zero-dimensional geometries (points) are simple iff they have no repeated points. Empty Geometrys are always simple.

Returns
true if this Geometry is simple
See also
IsValid
virtual bool NetTopologySuite.Geometries.Geometry.IsValid
get

Tests whether this Geometry is topologically valid, according to the OGC SFS specification.For validity rules see the documentation for the specific geometry subclass.

Returns
true if this Geometry is valid.
virtual double NetTopologySuite.Geometries.Geometry.Length
get

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

Returns
The length of the Geometry.
virtual int NetTopologySuite.Geometries.Geometry.NumGeometries
get

Returns the number of Geometryes in a GeometryCollection, or 1, if the geometry is not a collection.

abstract int NetTopologySuite.Geometries.Geometry.NumPoints
get

Returns the count of this Geometrys vertices. The Geometry s contained by composite Geometrys must be Geometry's; that is, they must implement NumPoints.

Returns
The number of vertices in this Geometry.
abstract OgcGeometryType NetTopologySuite.Geometries.Geometry.OgcGeometryType
get

Gets the OGC geometry type

IPoint NetTopologySuite.Geometries.Geometry.PointOnSurface
get
IPrecisionModel NetTopologySuite.Geometries.Geometry.PrecisionModel
get

Returns the PrecisionModel used by the Geometry.

Returns
the specification of the grid of allowable points, for this Geometry and all other Geometrys.
int NetTopologySuite.Geometries.Geometry.SRID
getset

Sets the ID of the Spatial Reference System used by the Geometry.

NOTE: This method should only be used for exceptional circumstances or for backwards compatibility. Normally the SRID should be set on the IGeometryFactory used to create the geometry. SRIDs set using this method will not be propagated to geometries returned by constructive methods.

See also
IGeometryFactory
object NetTopologySuite.Geometries.Geometry.UserData
getset

Gets/Sets the user data object for this point, if any.

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.


The documentation for this class was generated from the following file: