getReferenceCoordinate

fun getReferenceCoordinate(path: LineString, targetDistance: Double, reverseLineString: Boolean): LngLatAlt

Calculates a coordinate on a LineString at a target distance from the first coordinate of the LineString.

  • note: If the target distance is greater than the LineString distance, the last LineString coordinate is returned.

  • note: If the target distance is between two coordinates on the LineString, a synthesized coordinate between the coordinates is returned.

  • note: If the target distance is smaller or equal to zero, the first LineString coordinate is returned.

Return

The new coordinate as a LngLatAlt object.

Parameters

path

The LineString that we want to generate a new coordinate for.

targetDistance

The distance in meters that we want the coordinate to be on the LineString.

reverseLineString

Reverse the sort order of the LineString coordinates so "first" is "last"