Search Results for

    Show / Hide Table of Contents

    Class OverlayNG

    Computes the geometric overlay of two Geometrys, using an explicit precision model to allow robust computation.

    The overlay can be used to determine any of the following set-theoretic operations (boolean combinations) of the geometries:
    • Intersectionall points which lie in both geometries
    • Unionall points which lie in at least one geometry
    • Differenceall points which lie in the first geometry but not the second
    • SymDifferenceall points which lie in one geometry but not both
    Input geometries may have different dimension. Input collections must be homogeneous (all elements must have the same dimension). Inputs may be simple GeometryCollections. A GeometryCollection is simple if it can be flattened into a valid Multi-geometry; i.e.it is homogeneous and does not contain any overlapping Polygons.

    The precision model used for the computation can be supplied independent of the precision model of the input geometry. The main use for this is to allow using a fixed precision for geometry with a floating precision model. This does two things: ensures robust computation; and forces the output to be validly rounded to the precision model.

    For fixed precision models noding is performed using a SnapRoundingNoder. This provides robust computation(as long as precision is limited to around 13 decimal digits).

    For floating precision an MCIndexNoder is used. This is not fully robust, so can sometimes result in TopologyExceptions being thrown. For robust full-precision overlay see OverlayNGRobust.

    A custom INoder can be supplied. This allows using a more performant noding strategy in specific cases, for instance in CoverageUnion.

    Note: If a SnappingNoder is used it is best to specify a fairly small snap tolerance, since the intersection clipping optimization can interact with the snapping to alter the result.

    Optionally the overlay computation can process using strict mode (via StrictMode = true). In strict mode result semantics are:
    • Lines and Points resulting from topology collapses are not included in the result
    • Result geometry is homogeneous for the Intersection and Difference operations.
    • Result geometry is homogeneous for the Union and SymDifference operations if the inputs have the same dimension
    Strict mode has the following benefits:
    • Results are simpler
    • Overlay operations are easily chainable without needing to remove lower-dimension elements
    The original JTS overlay semantics corresponds to non-strict mode.

    If a robustness error occurs, a TopologyException is thrown. These are usually caused by numerical rounding causing the noding output to not be fully noded. For robust computation with full-precision OverlayNGRobust can be used.
    Inheritance
    object
    OverlayNG
    Inherited Members
    object.Equals(object)
    object.Equals(object, object)
    object.GetHashCode()
    object.GetType()
    object.ReferenceEquals(object, object)
    object.ToString()
    Namespace: NetTopologySuite.Operation.OverlayNG
    Assembly: NetTopologySuite.dll
    Syntax
    public sealed class OverlayNG

    Constructors

    | Edit this page View Source

    OverlayNG(Geometry, Geometry, PrecisionModel, ElevationModel, SpatialFunction)

    Creates an overlay operation on the given geometries, with a defined precision model.

    Declaration
    public OverlayNG(Geometry geom0, Geometry geom1, PrecisionModel pm, ElevationModel em, SpatialFunction opCode)
    Parameters
    Type Name Description
    Geometry geom0

    The A operand geometry

    Geometry geom1

    The B operand geometry (may be null)

    PrecisionModel pm

    The precision model to use

    ElevationModel em

    The elevation model to use. May be null

    SpatialFunction opCode

    The overlay opcode

    | Edit this page View Source

    OverlayNG(Geometry, Geometry, PrecisionModel, SpatialFunction)

    Creates an overlay operation on the given geometries, with a defined precision model.

    Declaration
    public OverlayNG(Geometry geom0, Geometry geom1, PrecisionModel pm, SpatialFunction opCode)
    Parameters
    Type Name Description
    Geometry geom0

    The A operand geometry

    Geometry geom1

    The B operand geometry (may be null)

    PrecisionModel pm

    The precision model to use

    SpatialFunction opCode

    The overlay opcode

    | Edit this page View Source

    OverlayNG(Geometry, Geometry, SpatialFunction)

    Creates an overlay operation on the given geometries using the precision model of the geometries.

    The noder is chosen according to the precision model specified.
    • For Fixed a snap - rounding noder is used, and the computation is robust.
    • For Floating a non - snapping noder is used, and this computation may not be robust.
    Declaration
    public OverlayNG(Geometry geom0, Geometry geom1, SpatialFunction opCode)
    Parameters
    Type Name Description
    Geometry geom0

    The A operand geometry

    Geometry geom1

    The B operand geometry (may be null)

    SpatialFunction opCode

    The overlay opcode

    Fields

    | Edit this page View Source

    DIFFERENCE

    The code for the Difference overlay operation.

    Declaration
    public const SpatialFunction DIFFERENCE = Difference
    Field Value
    Type Description
    SpatialFunction
    | Edit this page View Source

    INTERSECTION

    The code for the Intersection overlay operation.

    Declaration
    public const SpatialFunction INTERSECTION = Intersection
    Field Value
    Type Description
    SpatialFunction
    | Edit this page View Source

    SYMDIFFERENCE

    The code for the Symmetric Difference overlay operation.

    Declaration
    public const SpatialFunction SYMDIFFERENCE = SymDifference
    Field Value
    Type Description
    SpatialFunction
    | Edit this page View Source

    UNION

    The code for the Union overlay operation.

    Declaration
    public const SpatialFunction UNION = Union
    Field Value
    Type Description
    SpatialFunction

    Properties

    | Edit this page View Source

    AreaResultOnly

    Gets or sets whether the result can contain only Polygon components. This is used if it is known that the result must be an (possibly empty) area.

    Declaration
    public bool AreaResultOnly { get; set; }
    Property Value
    Type Description
    bool

    true if the result should contain only area components

    | Edit this page View Source

    Noder

    Declaration
    public INoder Noder { get; set; }
    Property Value
    Type Description
    INoder
    | Edit this page View Source

    Optimized

    Gets or sets a value indicating whether overlay processing optimizations are enabled.

    It may be useful to disable optimizations for testing purposes.

    Default is true (optimization enabled).
    Declaration
    public bool Optimized { get; set; }
    Property Value
    Type Description
    bool
    | Edit this page View Source

    OutputEdges

    Declaration
    public bool OutputEdges { get; set; }
    Property Value
    Type Description
    bool
    | Edit this page View Source

    OutputNodedEdges

    Declaration
    public bool OutputNodedEdges { get; set; }
    Property Value
    Type Description
    bool
    | Edit this page View Source

    OutputResultEdges

    Declaration
    public bool OutputResultEdges { get; set; }
    Property Value
    Type Description
    bool
    | Edit this page View Source

    StrictMode

    Gets or sets whether the overlay results are computed according to strict mode semantics.

    • Lines resulting from topology collapse are not included
    • Result geometry is homogeneous for the Intersection and Difference operations.
    • Result geometry is homogeneous for the Union and SymDifference operations if the inputs have the same dimension
    Declaration
    public bool StrictMode { get; set; }
    Property Value
    Type Description
    bool

    Methods

    | Edit this page View Source

    GetResult()

    Gets the result of the overlay operation. e

    Declaration
    public Geometry GetResult()
    Returns
    Type Description
    Geometry

    The result of the overlay operation.

    Exceptions
    Type Condition
    ArgumentException

    Thrown, if the input is not supported (e.g. a mixed-dimension geometry)

    TopologyException

    Thrown, if a robustness error occurs

    | Edit this page View Source

    Overlay(Geometry, Geometry, SpatialFunction)

    Computes an overlay operation on the given geometry operands, using the precision model of the geometry. and an appropriate noder.

    The noder is chosen according to the precision model specified.
    • For Fixed a snap-rounding noder is used, and the computation is robust.
    • For Floating a non-snapping noder is used, and this computation may not be robust. If errors occur a TopologyException is thrown.
    Declaration
    public static Geometry Overlay(Geometry geom0, Geometry geom1, SpatialFunction opCode)
    Parameters
    Type Name Description
    Geometry geom0

    The first geometry argument

    Geometry geom1

    The second geometry argument

    SpatialFunction opCode

    The code for the desired overlay operation

    Returns
    Type Description
    Geometry

    The result of the overlay operation

    | Edit this page View Source

    Overlay(Geometry, Geometry, SpatialFunction, PrecisionModel)

    Computes an overlay operation for the given geometry operands, with the noding strategy determined by the precision model.

    Declaration
    public static Geometry Overlay(Geometry geom0, Geometry geom1, SpatialFunction opCode, PrecisionModel pm)
    Parameters
    Type Name Description
    Geometry geom0

    The first geometry argument

    Geometry geom1

    The second geometry argument

    SpatialFunction opCode

    The code for the desired overlay operation

    PrecisionModel pm

    The precision model to use

    Returns
    Type Description
    Geometry

    The result of the overlay operation

    | Edit this page View Source

    Overlay(Geometry, Geometry, SpatialFunction, PrecisionModel, INoder)

    Computes an overlay operation for the given geometry operands, using a supplied INoder.

    Declaration
    public static Geometry Overlay(Geometry geom0, Geometry geom1, SpatialFunction opCode, PrecisionModel pm, INoder noder)
    Parameters
    Type Name Description
    Geometry geom0

    The first geometry argument

    Geometry geom1

    The second geometry argument

    SpatialFunction opCode

    The code for the desired overlay operation

    PrecisionModel pm

    The precision model to use (which may be null if the noder does not use one)

    INoder noder

    The noder to use

    Returns
    Type Description
    Geometry

    The result of the overlay operation

    | Edit this page View Source

    Overlay(Geometry, Geometry, SpatialFunction, INoder)

    Computes an overlay operation on the given geometry operands, using a supplied INoder.

    Declaration
    public static Geometry Overlay(Geometry geom0, Geometry geom1, SpatialFunction opCode, INoder noder)
    Parameters
    Type Name Description
    Geometry geom0

    The first geometry argument

    Geometry geom1

    The second geometry argument

    SpatialFunction opCode

    The code for the desired overlay operation

    INoder noder

    The noder to use

    Returns
    Type Description
    Geometry

    The result of the overlay operation

    • Edit this page
    • View Source
    In this article
    Back to top Generated by DocFX