I am using the Get Activity ById endpoint from the Strava API whcih returns a ActivityDetail object.
I can decode the polyline but it only returns the lat and lng values for each vertex.
I decode using:
import polyline from '@mapbox/polyline';
import { LatLngExpression } from 'leaflet';
export const decodePolyline = (
encodedString: string | undefined,
): LatLngExpression[] => {
if (!encodedString) return [];
const decoded = polyline.decode(encodedString);
return decoded;
};
I would like to get the altitude in order to draw the elevation graph too. Is there a different API call available to retrieve this data?
If your interested the repo Imj workin in is here: https://github.com/loanburger/strava-react-app
Thanks!
I have found another solution to this problem and wanted to share the approach. There is a ActivityStream API which can be used. It takes in the activity Id and the stream type you want then returns a stream result with the types you want:
A sample response for example the distance stream would look like:
[{
"type" : "distance",
"data" : [ 2.9, 5.8, 8.5, 11.7, 15, 19, 23.2, 28, 32.8, 38.1, 43.8, 49.5 ],
"series_type" : "distance",
"original_size" : 12,
"resolution" : "high"
}]
This basically gave me exactly what I was after.