Search Results for

    Show / Hide Table of Contents

    Class LinearLocation

    Represents a location along a LineString or MultiLineString.
    The referenced geometry is not maintained within this location, but must be provided for operations which require it. Various methods are provided to manipulate the location value and query the geometry it references.

    Inheritance
    object
    LinearLocation
    Implements
    IComparable<LinearLocation>
    IComparable
    Inherited Members
    object.Equals(object)
    object.Equals(object, object)
    object.GetHashCode()
    object.GetType()
    object.MemberwiseClone()
    object.ReferenceEquals(object, object)
    Namespace: NetTopologySuite.LinearReferencing
    Assembly: NetTopologySuite.dll
    Syntax
    public class LinearLocation : IComparable<LinearLocation>, IComparable

    Constructors

    | Edit this page View Source

    LinearLocation()

    Initializes a new instance of the LinearLocation class: creates a location referring to the start of a linear geometry.

    Declaration
    public LinearLocation()
    | Edit this page View Source

    LinearLocation(LinearLocation)

    Creates a new location equal to a given one.

    Declaration
    public LinearLocation(LinearLocation loc)
    Parameters
    Type Name Description
    LinearLocation loc

    A linear location

    | Edit this page View Source

    LinearLocation(int, double)

    Initializes a new instance of the LinearLocation class: creates a location referring to the start of a linear geometry.

    Declaration
    public LinearLocation(int segmentIndex, double segmentFraction)
    Parameters
    Type Name Description
    int segmentIndex

    Index of the segment.

    double segmentFraction

    The segment fraction.

    | Edit this page View Source

    LinearLocation(int, int, double)

    Initializes a new instance of the LinearLocation class: creates a location referring to the start of a linear geometry.

    Declaration
    public LinearLocation(int componentIndex, int segmentIndex, double segmentFraction)
    Parameters
    Type Name Description
    int componentIndex

    Index of the component.

    int segmentIndex

    Index of the segment.

    double segmentFraction

    The segment fraction.

    Properties

    | Edit this page View Source

    ComponentIndex

    Gets the component index for this location.

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

    IsVertex

    Tests whether this location refers to a vertex: returns true if the location is a vertex.

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

    SegmentFraction

    Gets the segment fraction for this location.

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

    SegmentIndex

    Gets the segment index for this location.

    Declaration
    public int SegmentIndex { get; }
    Property Value
    Type Description
    int

    Methods

    | Edit this page View Source

    Clamp(Geometry)

    Ensures the indexes are valid for a given linear Geometry.

    Declaration
    public void Clamp(Geometry linear)
    Parameters
    Type Name Description
    Geometry linear

    A linear geometry.

    | Edit this page View Source

    CompareLocationValues(int, int, double)

    Compares this object with the specified index values for order.

    Declaration
    public int CompareLocationValues(int componentIndex1, int segmentIndex1, double segmentFraction1)
    Parameters
    Type Name Description
    int componentIndex1

    The component index.

    int segmentIndex1

    The segment index.

    double segmentFraction1

    The segment fraction.

    Returns
    Type Description
    int

    A negative integer, zero, or a positive integer as this LineStringLocation is less than, equal to, or greater than the specified locationValues.

    | Edit this page View Source

    CompareLocationValues(int, int, double, int, int, double)

    Compares two sets of location values for order.

    Declaration
    public static int CompareLocationValues(int componentIndex0, int segmentIndex0, double segmentFraction0, int componentIndex1, int segmentIndex1, double segmentFraction1)
    Parameters
    Type Name Description
    int componentIndex0

    The first component index.

    int segmentIndex0

    The first segment index.

    double segmentFraction0

    The first segment fraction.

    int componentIndex1

    The second component index.

    int segmentIndex1

    The second segment index.

    double segmentFraction1

    The second segment fraction.

    Returns
    Type Description
    int

    A negative integer, zero, or a positive integer as the first set of location values is less than, equal to, or greater than the second set of locationValues.

    | Edit this page View Source

    CompareTo(LinearLocation)

    Compares the current instance with another object of the same type.

    Declaration
    public int CompareTo(LinearLocation other)
    Parameters
    Type Name Description
    LinearLocation other

    The LineStringLocation with which this Coordinate is being compared.

    Returns
    Type Description
    int

    A negative integer, zero, or a positive integer as this LineStringLocation is less than, equal to, or greater than the specified LineStringLocation.

    | Edit this page View Source

    CompareTo(object)

    Compares the current instance with another object of the same type.

    Declaration
    public int CompareTo(object obj)
    Parameters
    Type Name Description
    object obj

    The LineStringLocation with which this Coordinate is being compared.

    Returns
    Type Description
    int

    A negative integer, zero, or a positive integer as this LineStringLocation is less than, equal to, or greater than the specified LineStringLocation.

    Exceptions
    Type Condition
    ArgumentException

    obj is not the same type as this instance.

    | Edit this page View Source

    Copy()

    Declaration
    public LinearLocation Copy()
    Returns
    Type Description
    LinearLocation
    | Edit this page View Source

    GetCoordinate(Geometry)

    Gets the Coordinate along the given linear Geometry which is referenced by this location.

    Declaration
    public Coordinate GetCoordinate(Geometry linearGeom)
    Parameters
    Type Name Description
    Geometry linearGeom

    A linear geometry.

    Returns
    Type Description
    Coordinate

    The Coordinate at the location.

    | Edit this page View Source

    GetEndLocation(Geometry)

    Gets a location which refers to the end of a linear Geometry.

    Declaration
    public static LinearLocation GetEndLocation(Geometry linear)
    Parameters
    Type Name Description
    Geometry linear

    The linear geometry.

    Returns
    Type Description
    LinearLocation

    A new LinearLocation.

    | Edit this page View Source

    GetSegment(Geometry)

    Gets a LineSegment representing the segment of the given linear Geometry which contains this location.

    Declaration
    public LineSegment GetSegment(Geometry linearGeom)
    Parameters
    Type Name Description
    Geometry linearGeom

    A linear geometry

    Returns
    Type Description
    LineSegment

    the LineSegment containing the location

    | Edit this page View Source

    GetSegmentLength(Geometry)

    Gets the length of the segment in the given Geometry containing this location.

    Declaration
    public double GetSegmentLength(Geometry linearGeom)
    Parameters
    Type Name Description
    Geometry linearGeom

    A linear geometry.

    Returns
    Type Description
    double

    The length of the segment.

    | Edit this page View Source

    IsEndpoint(Geometry)

    Tests whether this location is an endpoint of the linear component it refers to.

    Declaration
    public bool IsEndpoint(Geometry linearGeom)
    Parameters
    Type Name Description
    Geometry linearGeom

    The linear geometry referenced by this location

    Returns
    Type Description
    bool

    True if the location is a component endpoint

    | Edit this page View Source

    IsOnSameSegment(LinearLocation)

    Tests whether two locations are on the same segment in the parent Geometry.

    Declaration
    public bool IsOnSameSegment(LinearLocation loc)
    Parameters
    Type Name Description
    LinearLocation loc

    A location on the same geometry

    Returns
    Type Description
    bool

    true if the locations are on the same segment of the parent geometry

    | Edit this page View Source

    IsValid(Geometry)

    Tests whether this location refers to a valid location on the given linear Geometry.

    Declaration
    public bool IsValid(Geometry linearGeom)
    Parameters
    Type Name Description
    Geometry linearGeom

    A linear geometry.

    Returns
    Type Description
    bool

    true if this location is valid.

    | Edit this page View Source

    PointAlongSegmentByFraction(Coordinate, Coordinate, double)

    Computes the Coordinate of a point a given fraction along the line segment (p0, p1).

    Declaration
    public static Coordinate PointAlongSegmentByFraction(Coordinate p0, Coordinate p1, double fraction)
    Parameters
    Type Name Description
    Coordinate p0

    The first point of the line segment.

    Coordinate p1

    The last point of the line segment.

    double fraction

    The length to the desired point.

    Returns
    Type Description
    Coordinate
    Remarks

    If the fraction is greater than 1.0 the last point of the segment is returned.

    If the fraction is less than or equal to 0.0 the first point of the segment is returned.

    The Z ordinate is interpolated from the Z-ordinates of the given points, if they are specified.

    | Edit this page View Source

    SetToEnd(Geometry)

    Sets the value of this location to refer to the end of a linear geometry.

    Declaration
    public void SetToEnd(Geometry linear)
    Parameters
    Type Name Description
    Geometry linear

    The linear geometry to use to set the end.

    | Edit this page View Source

    SnapToVertex(Geometry, double)

    Snaps the value of this location to the nearest vertex on the given linear Geometry, if the vertex is closer than minDistance.

    Declaration
    public void SnapToVertex(Geometry linearGeom, double minDistance)
    Parameters
    Type Name Description
    Geometry linearGeom

    A linear geometry.

    double minDistance

    The minimum allowable distance to a vertex.

    | Edit this page View Source

    ToLowest(Geometry)

    Converts a linear location to the lowest equivalent location index. The lowest index has the lowest possible component and segment indices. Specifically:

    • if the location point is an endpoint, a location value is returned as (nseg-1, 1.0)
    • if the location point is ambiguous (i.e. an endpoint and a startpoint), the lowest endpoint location is returned If the location index is already the lowest possible value, the original location is returned.
    Declaration
    public LinearLocation ToLowest(Geometry linearGeom)
    Parameters
    Type Name Description
    Geometry linearGeom

    The linear geometry referenced by this location.

    Returns
    Type Description
    LinearLocation

    The lowest equivalent location.

    | Edit this page View Source

    ToString()

    Declaration
    public override string ToString()
    Returns
    Type Description
    string
    Overrides
    object.ToString()

    Implements

    IComparable<T>
    IComparable
    • Edit this page
    • View Source
    In this article
    Back to top Generated by DocFX