GetPointOnLine()
Summary
Returns the coordinate along a line at a given position
Syntax
GetPointOnLine(int id, double position, array options)
| Argument | Contents |
|---|---|
| id | The unique identifier of the line layer |
| position | The position along the line (either absolute distance or relative position) |
Returns
The coordinate along the line at the given position
Notes
-
The current layer must be a line layer
-
If position is larger than the line length, or greater than 1 when the Relative option is True, GetPointOnLine() returns the coordinate of the line's end node, if Reverse is True, or the starting node, if Reverse is False.
-
If position is null, the function returns the line's end node, if Reverse is True, or the starting node, if Reverse is False.
Example
// Get the coordinate right at the middle of a line
Coord = GetPointOnLine(my_line_id, 0.5, {"Relative": "True"})Error Codes
| Option | Type | Contents |
|---|---|---|
| Relative | boolean | If True the position is computed as a relative position between 0.0 and 1.0. The default is False |
| Reverse | boolean | If True the position is computed from the line last point. The default is False, |
| Error Type | Meaning |
|---|---|
| Error | One of the parameters is invalid |
| LanguageError | The ID is not an integer, or the ID does not exist |
| Missing | The current layer is not a line layer |
See Also
| Function | Summary |
|---|---|
| GetEndpoints() | Returns the IDs of the two endpoints of a link. |
| GetLine() | Gets the coordinates that describe the location of a line feature |
| CoordToLineDistance() | Finds the nearest line feature to a point and returns information about it |
| GetLineDistance() | Finds the distance from a coordinate to a line |