my question is, how to get an elevation profile of the specified route from the MapBox service.
On the input we have path / route as the array of coordinates (latitute, longitute). As the result we would like to get the array of the pairs coordinate - elevation.
In case the resolution of elevation data is higher than the route coordinates provided, the result should contain also the elevation data between the original coordinates. The new points on the route would be generated according to the elevation data resolution. In case the resolution of elevation data is lower, it should interpolate the elevation values from the known data for the queried points. We would like to get results as precise as possible.
As the datasource for our solution we would like to use the MapBox service. However we did not find any documented MapBox API for this specific problem. We only found references to some Surface API, that is no longer supported.
As we understand Mapbox now stores elevation data in the format of Terrain-RGB map tiles. We identified the following steps to be able to solve our problem using MapBox:
- Decode the route coordinates to the minimal set of map tiles.
- Query the map tiles using MapBox API.
- For each coordinate of the route, map it to the specific image pixel.
- Translate the RGB color value of the pixel to the elevation in meters.
Is this algorithm correct? I think, that generating elevation profile for specific route is a common problem is there any tool that provides solution for our problem out of the box, maybe some SDK? Are we missing something? Thanks a lot.