Class LocationIndexedLine
Supports linear referencing along a linear Geometry using LinearLocations as the index.
Inherited Members
Namespace: NetTopologySuite.LinearReferencing
Assembly: NetTopologySuite.dll
Syntax
public class LocationIndexedLine
Constructors
| Edit this page View SourceLocationIndexedLine(Geometry)
Constructs an object which allows linear referencing along a given linear Geometry.
Declaration
public LocationIndexedLine(Geometry linearGeom)
Parameters
Type | Name | Description |
---|---|---|
Geometry | linearGeom | The linear geometry to reference alo |
Properties
| Edit this page View SourceEndIndex
Returns the index of the end of the line.
Declaration
public LinearLocation EndIndex { get; }
Property Value
Type | Description |
---|---|
LinearLocation |
StartIndex
Returns the index of the start of the line.
Declaration
public LinearLocation StartIndex { get; }
Property Value
Type | Description |
---|---|
LinearLocation |
Methods
| Edit this page View SourceClampIndex(LinearLocation)
Computes a valid index for this line by clamping the given index to the valid range of index values.
Declaration
public LinearLocation ClampIndex(LinearLocation index)
Parameters
Type | Name | Description |
---|---|---|
LinearLocation | index |
Returns
Type | Description |
---|---|
LinearLocation | A valid index value. |
ExtractLine(LinearLocation, LinearLocation)
Computes the LineString for the interval on the line between the given indices. If the start location is after the end location, the computed linear geometry has reverse orientation to the input line.
Declaration
public Geometry ExtractLine(LinearLocation startIndex, LinearLocation endIndex)
Parameters
Type | Name | Description |
---|---|---|
LinearLocation | startIndex | The index of the start of the interval. |
LinearLocation | endIndex | The index of the end of the interval. |
Returns
Type | Description |
---|---|
Geometry | The linear interval between the indices. |
ExtractPoint(LinearLocation)
Computes the Coordinatefor the point on the line at the given index.
If the index
is out of range,
the first or last point on the line will be returned.
Declaration
public Coordinate ExtractPoint(LinearLocation index)
Parameters
Type | Name | Description |
---|---|---|
LinearLocation | index | The index of the desired point. |
Returns
Type | Description |
---|---|
Coordinate | The Coordinate at the given index. |
Remarks
The Z-ordinate of the computed point will be interpolated from the Z-ordinates of the line segment containing it, if they exist.
ExtractPoint(LinearLocation, double)
Computes the Coordinate for the point on the line at the given index, offset by the given distance. If the index is out of range the first or last point on the line will be returned.
The computed point is offset to the left of the line if the offset distance is positive, to the right if negative. The Z-ordinate of the computed point will be interpolated from the Z-ordinates of the line segment containing it, if they exist.Declaration
public Coordinate ExtractPoint(LinearLocation index, double offsetDistance)
Parameters
Type | Name | Description |
---|---|---|
LinearLocation | index | The index of the desired point |
double | offsetDistance | The distance the point is offset from the segment (positive is to the left, negative is to the right) |
Returns
Type | Description |
---|---|
Coordinate | The Coordinate at the given index |
ExtractPoint(double, double)
Computes the Coordinate for the point on the line at the given index, offset by the given distance.
Declaration
public Coordinate ExtractPoint(double index, double offsetDistance)
Parameters
Type | Name | Description |
---|---|---|
double | index | The index of the desired point |
double | offsetDistance | The distance the point is offset from the segment (positive is to the left, negative is to the right) |
Returns
Type | Description |
---|---|
Coordinate | The Coordinate at the given index |
Remarks
If the index is out of range the first or last point on the line will be returned. The computed point is offset to the left of the line if the offset distance is positive, to the right if negative. The Z-ordinate of the computed point will be interpolated from the Z-ordinates of the line segment containing it, if they exist.
IndexOf(Coordinate)
Computes the index for a given point on the line. The supplied point does not necessarily have to lie precisely on the line, but if it is far from the line the accuracy and performance of this function is not guaranteed. Use Project(Coordinate) to compute a guaranteed result for points which may be far from the line.
Declaration
public LinearLocation IndexOf(Coordinate pt)
Parameters
Type | Name | Description |
---|---|---|
Coordinate | pt | A point on the line. |
Returns
Type | Description |
---|---|
LinearLocation | The index of the point. |
See Also
| Edit this page View SourceIndexOfAfter(Coordinate, LinearLocation)
Finds the index for a point on the line which is greater than the given index.
If no such index exists, returns minIndex
.
Declaration
public LinearLocation IndexOfAfter(Coordinate pt, LinearLocation minIndex)
Parameters
Type | Name | Description |
---|---|---|
Coordinate | pt | A point on the line |
LinearLocation | minIndex | The value the returned index must be greater than |
Returns
Type | Description |
---|---|
LinearLocation | The index of the point greater than the given minimum index |
Remarks
This method can be used to determine all indexes for a point which occurs more than once on a non-simple line. It can also be used to disambiguate cases where the given point lies slightly off the line and is equidistant from two different points on the line.
The supplied point does not necessarily have to lie precisely on the line, but if it is far from the line the accuracy and performance of this function is not guaranteed. Use Project(Coordinate) to compute a guaranteed result for points which may be far from the line.
See Also
| Edit this page View SourceIndicesOf(Geometry)
Computes the indices for a subline of the line. (The subline must conform to the line; that is, all vertices in the subline (except possibly the first and last) must be vertices of the line and occur in the same order).
Declaration
public LinearLocation[] IndicesOf(Geometry subLine)
Parameters
Type | Name | Description |
---|---|---|
Geometry | subLine | A subLine of the line. |
Returns
Type | Description |
---|---|
LinearLocation[] | A pair of indices for the start and end of the subline. |
IsValidIndex(LinearLocation)
Tests whether an index is in the valid index range for the line.
Declaration
public bool IsValidIndex(LinearLocation index)
Parameters
Type | Name | Description |
---|---|---|
LinearLocation | index | The index to test. |
Returns
Type | Description |
---|---|
bool |
|
Project(Coordinate)
Computes the index for the closest point on the line to the given point. If more than one point has the closest distance the first one along the line is returned. (The point does not necessarily have to lie precisely on the line.)
Declaration
public LinearLocation Project(Coordinate pt)
Parameters
Type | Name | Description |
---|---|---|
Coordinate | pt | A point on the line. |
Returns
Type | Description |
---|---|
LinearLocation | The index of the point. |