Search Results for

    Show / Hide Table of Contents

    Class Geometry

    A representation of a planar, linear vector geometry.

    Inheritance
    object
    Geometry
    GeometryCollection
    LineString
    Point
    Polygon
    Implements
    IComparable
    IComparable<Geometry>
    Inherited Members
    object.Equals(object, object)
    object.GetType()
    object.MemberwiseClone()
    object.ReferenceEquals(object, object)
    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 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(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

    | Edit this page View Source

    Geometry(GeometryFactory)

    Creates a new Geometry via the specified GeometryFactory.

    Declaration
    protected Geometry(GeometryFactory factory)
    Parameters
    Type Name Description
    GeometryFactory factory

    The factory

    Fields

    | Edit this page View Source

    DefaultFactory

    A predefined GeometryFactory with PrecisionModel == Fixed.

    Declaration
    public static readonly GeometryFactory DefaultFactory
    Field Value
    Type Description
    GeometryFactory
    See Also
    Default
    Fixed
    | Edit this page View Source

    TypeNameGeometryCollection

    The name of geometry collection geometries.

    Declaration
    public const string TypeNameGeometryCollection = "GeometryCollection"
    Field Value
    Type Description
    string
    | Edit this page View Source

    TypeNameLineString

    The name of linestring geometries

    Declaration
    public const string TypeNameLineString = "LineString"
    Field Value
    Type Description
    string
    | Edit this page View Source

    TypeNameLinearRing

    The name of linearring geometries

    Declaration
    public const string TypeNameLinearRing = "LinearRing"
    Field Value
    Type Description
    string
    | Edit this page View Source

    TypeNameMultiLineString

    The name of multi-linestring geometries

    Declaration
    public const string TypeNameMultiLineString = "MultiLineString"
    Field Value
    Type Description
    string
    | Edit this page View Source

    TypeNameMultiPoint

    The name of multi-point geometries

    Declaration
    public const string TypeNameMultiPoint = "MultiPoint"
    Field Value
    Type Description
    string
    | Edit this page View Source

    TypeNameMultiPolygon

    The name of multi-polygon geometries

    Declaration
    public const string TypeNameMultiPolygon = "MultiPolygon"
    Field Value
    Type Description
    string
    | Edit this page View Source

    TypeNamePoint

    The name of point geometries

    Declaration
    public const string TypeNamePoint = "Point"
    Field Value
    Type Description
    string
    | Edit this page View Source

    TypeNamePolygon

    The name of polygon geometries

    Declaration
    public const string TypeNamePolygon = "Polygon"
    Field Value
    Type Description
    string

    Properties

    | Edit this page View Source

    Area

    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.

    | Edit this page View Source

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

    | Edit this page View Source

    BoundaryDimension

    Returns the dimension of this Geometrys 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 Dimension.False if the boundary is the empty point.

    | Edit this page View Source

    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.

    | Edit this page View Source

    Coordinate

    Returns a vertex of this geometry (usually, but not necessarily, the first one), or null if the geometry is empty.

    Declaration
    public abstract Coordinate Coordinate { get; }
    Property Value
    Type Description
    Coordinate

    A coordinate which is a vertex of this Geometry.

    Remarks

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

    | Edit this page View Source

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

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

    See Also
    GeometryChanged()
    SetOrdinate(int, int, double)
    SetOrdinate(int, Ordinate, double)
    | Edit this page View Source

    Dimension

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

    See Also
    HasDimension(Dimension)
    | Edit this page View Source

    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
    ToGeometry(Envelope)
    | Edit this page View Source

    EnvelopeInternal

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

    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.

    | Edit this page View Source

    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.

    | Edit this page View Source

    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 Geometrys actual class.

    | Edit this page View Source

    InteriorPoint

    Computes an interior point of this Geometry.

    Declaration
    public virtual Point InteriorPoint { get; }
    Property Value
    Type Description
    Point

    A Point which is in the interior of this Geometry.

    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.
    | Edit this page View Source

    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
    bool

    true if this Geometry does not cover any points.

    | Edit this page View Source

    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
    bool

    true if this is a heterogeneous GeometryCollection

    | Edit this page View Source

    IsRectangle

    Tests whether this is a rectangular Polygon.

    Declaration
    public virtual bool IsRectangle { get; }
    Property Value
    Type Description
    bool

    true if the geometry is a rectangle.

    Remarks

    Polygon overrides to check for actual rectangle.

    | Edit this page View Source

    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 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 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 Geometrys are always simple.
    Declaration
    public virtual bool IsSimple { get; }
    Property Value
    Type Description
    bool

    true if this Geometry is simple

    See Also
    IsValid
    | Edit this page View Source

    IsValid

    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
    bool

    true if this Geometry is valid.

    | Edit this page View Source

    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.

    | Edit this page View Source

    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
    int
    | Edit this page View Source

    NumPoints

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

    Declaration
    public abstract int NumPoints { get; }
    Property Value
    Type Description
    int

    The number of vertices in this Geometry.

    | Edit this page View Source

    OgcGeometryType

    Gets the OGC geometry type

    Declaration
    public abstract OgcGeometryType OgcGeometryType { get; }
    Property Value
    Type Description
    OgcGeometryType
    | Edit this page View Source

    PointOnSurface

    InteriorPoint

    Declaration
    public Point PointOnSurface { get; }
    Property Value
    Type Description
    Point
    | Edit this page View Source

    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 Geometry and all other Geometrys.

    | Edit this page View Source

    SRID

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

    Declaration
    public int SRID { get; set; }
    Property Value
    Type Description
    int
    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. SRIDs set using this method will change the Factory.

    See Also
    GeometryFactory
    | Edit this page View Source

    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.

    | Edit this page View Source

    UserData

    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

    | Edit this page View Source

    Apply(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 Geometry's coordinates

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

    | Edit this page View Source

    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.

    | Edit this page View Source

    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.

    | Edit this page View Source

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

    | Edit this page View Source

    Apply(IGeometryFilter)

    Performs an operation with or on this Geometry and its subelement Geometrys (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 Geometry (and its children, if it is a GeometryCollection).

    | Edit this page View Source

    AsBinary()

    ToBinary()

    Declaration
    public byte[] AsBinary()
    Returns
    Type Description
    byte[]
    | Edit this page View Source

    AsText()

    ToText()

    Declaration
    public string AsText()
    Returns
    Type Description
    string
    | Edit this page View Source

    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 PrecisionModel of the Geometry.

    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, EndCapStyle)
    Buffer(double, BufferParameters)
    Buffer(double, int)
    Buffer(double, int, EndCapStyle)
    | Edit this page View Source

    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 PrecisionModel of the Geometry.

    BufferParameters bufferParameters

    This argument type has a number of properties that control the construction of the buffer, including QuadrantSegments, EndCapStyle, JoinStyle, and MitreLimit

    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
    Buffer(double)
    Buffer(double, EndCapStyle)
    Buffer(double, int)
    Buffer(double, int, EndCapStyle)
    | Edit this page View Source

    Buffer(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 PrecisionModel of the Geometry.

    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)
    Buffer(double, BufferParameters)
    Buffer(double, int)
    Buffer(double, int, EndCapStyle)
    | Edit this page View Source

    Buffer(double, int)

    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 PrecisionModel of the Geometry.

    int 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)
    Buffer(double, EndCapStyle)
    Buffer(double, BufferParameters)
    Buffer(double, int, EndCapStyle)
    | Edit this page View Source

    Buffer(double, int, 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 PrecisionModel of the Geometry.

    int 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
    Buffer(double)
    Buffer(double, EndCapStyle)
    Buffer(double, BufferParameters)
    Buffer(double, int)
    | Edit this page View Source

    CheckNotGeometryCollection(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 Geometry to check.

    Exceptions
    Type Condition
    ArgumentException

    if g is a GeometryCollection, but not one of its subclasses.

    | Edit this page View Source

    Compare(List<Geometry>, List<Geometry>)

    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.

    Declaration
    protected static int Compare(List<Geometry> a, List<Geometry> b)
    Parameters
    Type Name Description
    List<Geometry> a

    A Collection of IComparables.

    List<Geometry> b

    A Collection of IComparables.

    Returns
    Type Description
    int

    The first non-zero compareTo result, if any; otherwise, zero.

    | Edit this page View Source

    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 Geometry with which to compare this Geometry

    Returns
    Type Description
    int

    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.

    Remarks

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

    • Point (lowest),
    • MultiPoint,
    • LineString,
    • LinearRing,
    • MultiLineString,
    • Polygon,
    • MultiPolygon,
    • GeometryCollection (highest).
    If the two Geometrys have the same class, their first elements are compared. If those are the same, the second elements are compared, etc.
    | Edit this page View Source

    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 Geometry with which to compare this Geometry

    Returns
    Type Description
    int

    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.

    Remarks

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

    • Point (lowest),
    • MultiPoint,
    • LineString,
    • LinearRing,
    • MultiLineString,
    • Polygon,
    • MultiPolygon,
    • GeometryCollection (highest).
    If the two Geometrys have the same class, their first elements are compared. If those are the same, the second elements are compared, etc.
    | Edit this page View Source

    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 Geometry with which to compare this Geometry

    IComparer<CoordinateSequence> comp

    A IComparer<CoordinateSequence>

    Returns
    Type Description
    int

    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.

    Remarks

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

    • Point (lowest),
    • MultiPoint,
    • LineString,
    • LinearRing,
    • MultiLineString,
    • Polygon,
    • MultiPolygon,
    • GeometryCollection (highest).
    If the two Geometrys have the same class, their first elements are compared. If those are the same, the second elements are compared, etc.
    | Edit this page View Source

    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 Geometry having the same class as this Geometry.

    Returns
    Type Description
    int

    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.

    | Edit this page View Source

    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 Geometry having the same class as this Geometry

    IComparer<CoordinateSequence> comp

    The comparer

    Returns
    Type Description
    int

    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 JTS Technical Specifications

    | Edit this page View Source

    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 Geometrys bounding box; if the Geometry is empty, Envelope.IsNull will return true.

    | Edit this page View Source

    Contains(Geometry)

    Tests whether this geometry contains the argument geometry.

    Declaration
    public virtual bool Contains(Geometry g)
    Parameters
    Type Name Description
    Geometry g

    the Geometry with which to compare this Geometry

    Returns
    Type Description
    bool

    true if this Geometry contains g

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

    | Edit this page View Source

    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 Geometry's points.

    | Edit this page View Source

    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.

    | Edit this page View Source

    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.

    | Edit this page View Source

    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 Geometry with which to compare this Geometry

    Returns
    Type Description
    bool

    true if this Geometry is covered by g

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

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

    See Also
    Within(Geometry)
    Covers(Geometry)
    | Edit this page View Source

    Covers(Geometry)

    Tests whether this geometry covers the argument geometry

    Declaration
    public virtual bool Covers(Geometry g)
    Parameters
    Type Name Description
    Geometry g

    The Geometry with which to compare this Geometry

    Returns
    Type Description
    bool

    true if this Geometry covers g

    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*]
    • g.CoveredBy(this) == true
      (covers is the converse of CoveredBy(Geometry))
    If either geometry is empty, the value of this predicate is 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
    Contains(Geometry)
    CoveredBy(Geometry)
    | Edit this page View Source

    CreateArray(CoordinateSequence, Ordinate)

    Declaration
    protected static double[] CreateArray(CoordinateSequence sequence, Ordinate ordinate)
    Parameters
    Type Name Description
    CoordinateSequence sequence
    Ordinate ordinate
    Returns
    Type Description
    double[]
    | Edit this page View Source

    CreateArray(int, double)

    Declaration
    protected static double[] CreateArray(int size, double value)
    Parameters
    Type Name Description
    int size
    double value
    Returns
    Type Description
    double[]
    | Edit this page View Source

    Crosses(Geometry)

    Tests whether this geometry crosses the specified geometry.

    Declaration
    public virtual bool Crosses(Geometry g)
    Parameters
    Type Name Description
    Geometry g

    The Geometry with which to compare this Geometry

    Returns
    Type Description
    bool

    true if the two Geometrys cross.

    Remarks

    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 the A/A and P/P situations this predicate returns 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.

    | Edit this page View Source

    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 Geometry with which to compute the difference.

    Returns
    Type Description
    Geometry

    A Geometry representing the point-set difference of this Geometry with other.

    Exceptions
    Type Condition
    ArgumentException

    if the argument has a factory with a different GeometryOverlay object assigned

    | Edit this page View Source

    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 Geometry with which to compare this Geometry.

    Returns
    Type Description
    bool

    true if the two Geometrys are disjoint.

    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 of Intersects)
    | Edit this page View Source

    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 Geometry from which to compute the distance.

    Returns
    Type Description
    double

    The distance between the geometries

    Exceptions
    Type Condition
    ArgumentException

    if g is null

    | Edit this page View Source

    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
    bool
    | Edit this page View Source

    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 Geometry with which to compare this Geometry

    Returns
    Type Description
    bool

    true if the two Geometrys are topologically equal.

    See Also
    EqualsTopologically(Geometry)
    | Edit this page View Source

    Equals(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
    bool

    true if this geometry is exactly equal to the argument

    Overrides
    object.Equals(object)
    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 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 Normalized() or Normalize() as appropriate).
    See Also
    EqualsExact(Geometry)
    GetHashCode()
    Normalized()
    Normalize()
    | Edit this page View Source

    EqualsExact(Geometry)

    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(Geometry), 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.
    Declaration
    public bool EqualsExact(Geometry other)
    Parameters
    Type Name Description
    Geometry other

    The Geometry with which to compare this Geometry.

    Returns
    Type Description
    bool

    true if this and the other Geometry have identical structure and point values.

    | Edit this page View Source

    EqualsExact(Geometry, double)

    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.
    Declaration
    public abstract bool EqualsExact(Geometry other, double tolerance)
    Parameters
    Type Name Description
    Geometry other

    The Geometry with which to compare this Geometry have identical structure and point values, up to the distance tolerance.

    double tolerance

    Distance at or below which two Coordinates will be considered equal.

    Returns
    Type Description
    bool

    true if this and the other Geometry are of the same class and have equal internal data.

    See Also
    EqualsExact(Geometry)
    Normalize()
    Normalized()
    | Edit this page View Source

    EqualsNormalized(Geometry)

    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 EqualsExact(Geometry).

    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
    bool

    true if the input geometries are exactly equal in their normalized form

    See Also
    EqualsExact(Geometry)
    | Edit this page View Source

    EqualsTopologically(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 Geometry with which to compare this Geometry

    Returns
    Type Description
    bool

    true if the two Geometrys are topologically equal

    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*
      
    Note that this method computes topologically equality. For structural equality, see {@link #equalsExact(Geometry)}.
    | Edit this page View Source

    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.

    | Edit this page View Source

    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()
    | Edit this page View Source

    GetGeometryN(int)

    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
    int n

    The index of the geometry element.

    Returns
    Type Description
    Geometry

    The n'th geometry contained in this geometry.

    | Edit this page View Source

    GetHashCode()

    Gets a hash code for the Geometry.

    Declaration
    public override int GetHashCode()
    Returns
    Type Description
    int

    An integer value suitable for use as a hashcode

    Overrides
    object.GetHashCode()
    | Edit this page View Source

    GetOrdinates(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

    | Edit this page View Source

    HasDimension(Dimension)

    Tests whether an atomic geometry or any element of a collection has the specified dimension.
    In particular, this can be used with mixed-dimension GeometryCollections to test if they contain an element of the specified dimension.

    Declaration
    public virtual bool HasDimension(Dimension dim)
    Parameters
    Type Name Description
    Dimension dim

    The dimension to test

    Returns
    Type Description
    bool

    true if the geometry has or contains an element with the dimension

    See Also
    Dimension
    | Edit this page View Source

    HasNonEmptyElements(Geometry[])

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

    Declaration
    protected static bool HasNonEmptyElements(Geometry[] geometries)
    Parameters
    Type Name Description
    Geometry[] geometries

    an array of Geometrys; no elements may be null

    Returns
    Type Description
    bool

    true if any of the Geometrys IsEmpty methods return false.

    | Edit this page View Source

    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
    bool

    true if any of arrays elements are null.

    | Edit this page View Source

    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
    bool

    true if any of arrays elements are null.

    Type Parameters
    Name Description
    T
    | Edit this page View Source

    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 Geometry with which to compute the intersection.

    Returns
    Type Description
    Geometry

    A geometry representing the point-set common to the two Geometrys.

    Exceptions
    Type Condition
    TopologyException

    if a robustness error occurs.

    ArgumentException

    if the argument is a non-empty heterogeneous GeometryCollection

    ArgumentException

    if the argument has a factory with a different GeometryOverlay object assigned

    | Edit this page View Source

    Intersects(Geometry)

    Tests whether this geometry intersects the argument geometry.

    Declaration
    public virtual bool Intersects(Geometry g)
    Parameters
    Type Name Description
    Geometry g

    The Geometry with which to compare this Geometry.

    Returns
    Type Description
    bool

    true if the two Geometrys intersect.

    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 of Disjoint)
    | Edit this page View Source

    IsEquivalentClass(Geometry)

    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.

    Declaration
    protected virtual bool IsEquivalentClass(Geometry other)
    Parameters
    Type Name Description
    Geometry other

    The Geometry with which to compare this Geometry for equality.

    Returns
    Type Description
    bool

    true if the classes of the two Geometry s are considered to be equal by the equalsExact method.

    | Edit this page View Source

    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
    bool

    true if the geometries are less than distance apart.

    | Edit this page View Source

    Normalize()

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

    Declaration
    public abstract void Normalize()
    Remarks

    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.

    | Edit this page View Source

    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
    Normalize()
    | Edit this page View Source

    Overlaps(Geometry)

    Tests whether this geometry overlaps the specified geometry.

    Declaration
    public virtual bool Overlaps(Geometry g)
    Parameters
    Type Name Description
    Geometry g

    The Geometry with which to compare this Geometry.

    Returns
    Type Description
    bool

    true if the two Geometrys overlap. For this function to return true, the Geometry s must be two points, two curves or two surfaces.

    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)
    If the geometries are of different dimension this predicate returns false.
    | Edit this page View Source

    Relate(Geometry)

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

    Declaration
    public virtual IntersectionMatrix Relate(Geometry g)
    Parameters
    Type Name Description
    Geometry g

    The Geometry with which to compare this Geometry

    Returns
    Type Description
    IntersectionMatrix

    A matrix describing the intersections of the interiors, boundaries and exteriors of the two Geometrys.

    | Edit this page View Source

    Relate(Geometry, string)

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

    Declaration
    public virtual bool Relate(Geometry g, string intersectionPattern)
    Parameters
    Type Name Description
    Geometry g

    the Geometry with which to compare this Geometry

    string intersectionPattern

    the pattern against which to check the intersection matrix for the two Geometrys

    Returns
    Type Description
    bool

    true if the DE-9IM intersection matrix for the two Geometrys match intersectionPattern

    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)
    For more information on the DE-9IM, see the OpenGIS Simple Features Specification.
    See Also
    IntersectionMatrix
    | Edit this page View Source

    Reverse()

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

    | Edit this page View Source

    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.

    | Edit this page View Source

    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 Geometry with which to compute the symmetric difference.

    Returns
    Type Description
    Geometry

    a Geometry representing the point-set symmetric difference of this Geometry with other.

    Exceptions
    Type Condition
    ArgumentException

    if the argument has a factory with a different GeometryOverlay object assigned

    | Edit this page View Source

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

    | Edit this page View Source

    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
    | Edit this page View Source

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

    Overrides
    object.ToString()
    | Edit this page View Source

    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.

    Declaration
    public string ToText()
    Returns
    Type Description
    string

    The Well-known Text representation of this Geometry.

    | Edit this page View Source

    Touches(Geometry)

    Tests whether this geometry touches the argument geometry

    Declaration
    public virtual bool Touches(Geometry g)
    Parameters
    Type Name Description
    Geometry g

    The Geometry with which to compare this Geometry.

    Returns
    Type Description
    bool

    true if the two Geometrys touch; Returns false if both Geometrys are points.

    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***** or
      • F***T****.
    If both geometries have dimension 0, the predicate returns false, since points have only interiors. This predicate is symmetric.
    | Edit this page View Source

    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

    | Edit this page View Source

    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 Geometry with which to compute the union

    Returns
    Type Description
    Geometry

    A point-set combining the points of this Geometry and the points of other

    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 GeometryOverlay object assigned

    See Also
    LineMerger
    | Edit this page View Source

    Within(Geometry)

    Tests whether this geometry is within the specified geometry.

    Declaration
    public bool Within(Geometry g)
    Parameters
    Type Name Description
    Geometry g

    The Geometry with which to compare this Geometry.

    Returns
    Type Description
    bool

    true if this Geometry is within other.

    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

    | Edit this page View Source

    operator ==(Geometry, Geometry)

    Declaration
    public static bool operator ==(Geometry obj1, Geometry obj2)
    Parameters
    Type Name Description
    Geometry obj1
    Geometry obj2
    Returns
    Type Description
    bool
    | Edit this page View Source

    operator !=(Geometry, Geometry)

    Declaration
    public static bool operator !=(Geometry obj1, Geometry obj2)
    Parameters
    Type Name Description
    Geometry obj1
    Geometry obj2
    Returns
    Type Description
    bool

    Implements

    IComparable
    IComparable<T>

    Extension Methods

    PolygonalExtracter.GetPolygonals<TCollection>(Geometry)
    PolygonalExtracter.GetPolygonals<TCollection>(Geometry, TCollection)
    • Edit this page
    • View Source
    In this article
    Back to top Generated by DocFX