Learn R Programming

gtfstools (version 2.0.1)

shape_point_distances: Distance from each shape point to the previous one

Description

Distance from each shape point to the previous one

Usage

shape_point_distances(shape_id, lat, lon)

Value

A numeric vector of distances in meters, on the same sphere used by {s2}. The first point of each shape is 0 meters away from its "previous" point, whatever its coordinates. For any other point, a missing coordinate in it or in the previous point gives NA.

Arguments

shape_id, lat, lon

The shape_id and coordinates of the shape points, sorted by shape and sequence, so that the points of each shape are contiguous.