Class IsSimpleOp
Tests whether a Geometry
is simple as defined by the OGC SFS specification.
Simplicity is defined for each Geometry type as follows:
- Pointgeometries are simple.
- MultiPointgeometries are simple if every point is unique
- LineStringgeometries are simple if they do not self-intersect at interior points (i.e.points other than the endpoints). Closed linestrings which intersect only at their endpoints are simple (i.e. valid LinearRingss.
- MultiLineStringgeometries are simple if their elements are simple and they intersect only at points which are boundary points of both elements. (The notion of boundary points can be user-specified - see below).
- Polygonalgeometries have no definition of simplicity.
The
IsSimple
code checks if all polygon rings are simple. (Note: this means thatIsSimple cannot be used to test for all self-intersections in Polygon s. In order to check if a IPolygonal geometry has self-intersections, use IsValid. - GeometryCollectiongeometries are simple if all their elements are simple.
- Empty geometries are simple
Note that under the Mod-2 rule, closed LineStrings (rings)
have no boundary.
This means that an intersection at the endpoints of
two closed LineStrings makes the geometry non-simple.
This means that an intersection at their endpoints makes the geometry non-simple.
If it is required to test whether a set of LineString
s touch
only at their endpoints, use EndpointBoundaryRule.
For example, this can be used to validate that a collection of lines
form a topologically valid linear network.
By default this class finds a single non-simple location. To find all non-simple locations, set FindAllLocations before calling IsSimple(), and retrieve the locations via NonSimpleLocations. This can be used to find all intersection points in a linear network.
Inherited Members
Namespace: NetTopologySuite.Operation.Valid
Assembly: NetTopologySuite.dll
Syntax
public class IsSimpleOp
Constructors
| Improve this Doc View SourceIsSimpleOp(Geometry)
Creates a simplicity checker using the default SFS Mod-2 Boundary Node Rule
Declaration
public IsSimpleOp(Geometry geom)
Parameters
Type | Name | Description |
---|---|---|
Geometry | geom | The geometry to test |
IsSimpleOp(Geometry, IBoundaryNodeRule)
Creates a simplicity checker using a given IBoundaryNodeRule
Declaration
public IsSimpleOp(Geometry geom, IBoundaryNodeRule boundaryNodeRule)
Parameters
Type | Name | Description |
---|---|---|
Geometry | geom | The geometry to test |
IBoundaryNodeRule | boundaryNodeRule | The boundary node rule to use |
Properties
| Improve this Doc View SourceFindAllLocations
Gets or sets a value indicating if all non-simple points should be reported.
Declaration
public bool FindAllLocations { get; set; }
Property Value
Type | Description |
---|---|
Boolean |
NonSimpleLocation
Gets the coordinate for an location where the geometry fails to be simple (i.e. where it has a non-boundary self-intersection).
Declaration
public Coordinate NonSimpleLocation { get; }
Property Value
Type | Description |
---|---|
Coordinate | A |
NonSimpleLocations
Gets all non-simple intersection locations.
Declaration
public IList<Coordinate> NonSimpleLocations { get; }
Property Value
Type | Description |
---|---|
IList<Coordinate> | A list of the |
Methods
| Improve this Doc View SourceGetNonSimpleLocation(Geometry)
Gets a non-simple location in a geometry, if any.
Declaration
public static Coordinate GetNonSimpleLocation(Geometry geom)
Parameters
Type | Name | Description |
---|---|---|
Geometry | geom | The input geometry |
Returns
Type | Description |
---|---|
Coordinate | A non-simple location, or |
IsSimple()
Tests whether the geometry is simple.
Declaration
public bool IsSimple()
Returns
Type | Description |
---|---|
Boolean |
|
IsSimple(Geometry)
Tests whether a geometry is simple.
Declaration
public static bool IsSimple(Geometry geom)
Parameters
Type | Name | Description |
---|---|---|
Geometry | geom | The input geometry |
Returns
Type | Description |
---|---|
Boolean |
|