I have an OpenLayers client displaying tracks from a vector source. I would like to display an elevation profile of the track. When hovering mouse on a point on the elevation profile, a marker should appear on the corresponding map point. Are there any online resources on building this?
[GIS] OpenLayers: line elevation profile with slider
elevationopenlayers
Best Answer
It would be helpful to know what type of elevation profile you are using to achieve this but in reality it doesn't matter.
I managed to do this by assigning a function to a hover event on a Kendo chart but it could be done using a data table or similar. I'm assuming that you are using Openlayers 3?
Basically on hover, if you identify the latitude and longitude of the item; you will need to convert these values to a coordinate which matches the map's projection and then create a feature with these coordinates and it to the map.
It can only be added to the map by creating a vector source and adding this feature to the source, then creating a layer which uses this source, and adding this layer to the map.
I'll supply the code I used and hopefully you should be able to figure it out from there.