coordinatesAtOffsetInMeters method

GeoCoordinates coordinatesAtOffsetInMeters(
  1. double offsetInMeters,
  2. GeoPolylineDirection direction
)

Returns the coordinates at the given distance along the polyline.

When the polyline is traversed from the beginning, the distance is calculated from the start of the polyline; while a direction from the end indicates a distance from the last vertex.

The offset is expected to be non-negative and smaller than the length of the polyline. When the offset is negative, the function returns the starting end point of the polyline, i.e. the first vertex in positive direction and the last vertex in the negative direction. Similarly, when the offset is larger than the length of the polyline, then the function returns the opposite end point of the polyline.

The distance between two consecutive vertices is calculated using the GeoCoordinates.distanceTo function. Therefore, it computes the distance (in meters) along the great circle between the two vertices. Similarly, the full length of the polyline is the sum of the distances between its vertices. The interpolation coordinates between two vertices is calculated using the GeoCoordinates.interpolate function.

Note: the result may different from the analogue result from other matching components since they may adapt the result to the length of the underlying object described by the polyline.

  • offsetInMeters The distance along the polyline in meters

  • direction The direction in which the polyline is traversed.

Returns GeoCoordinates. The coordinates of the point at the given distance

Implementation

GeoCoordinates coordinatesAtOffsetInMeters(double offsetInMeters, GeoPolylineDirection direction) => $prototype.coordinatesAtOffsetInMeters(this, offsetInMeters, direction);