The Elevation API provided by Google, uses two parameters for requesting height along a path: path
and samples
. The path is the lat
and lng
of the starting and the finish points and the samples
is the sample points along a path for which to return elevation data. So the path is divided into an ordered set of equidistant points along the path, which are sent back to the client as an array of lat
, lng
and elevation
for each point. This can be useful for visualizing elevation profiles or such.
I have seen other open-source alternatives for the Google Elevation API, however, none of them has an easy way to provide a samples
parameter, so if one wants to achieve the same, you simply have to somehow 'explode' the path yourself into multiple equidistant points and send this array as part of the URL to the back-end.
Is there a library or algorithm I should consider when splitting the path (which is usually of type LineString / polyline) into equidistant points? In general, how should I approach this problem?