More

Animating marker in OpenLayers 3?

Animating marker in OpenLayers 3?


I have been trying to find a marker animation plugin for OpenLayers to sync lat, lon, and time data along a track like this (in Leaflet):

https://github.com/hallahan/LeafletPlayback

http://leafletplayback.theoutpost.io/examples/example_1.html

Is it possible to animate a marker in OpenLayers, given the way it draws on the canvas?


Yes it is possible to animate markers in Openlayers 3. You can see an example of this from their examples page: http://openlayers.org/en/latest/examples/feature-move-animation.html

Basically you will need to:

  1. have an array of coordinates that represent the path (which I assume you have)
  2. listen to the 'postcompose' event and render along that path array

For your case, you will need to map time to indices of that path array in order to iterate through the array of coordinates and render accordingly.


Watch the video: Openlayers 6 Tutorial #1 - Introduction to Openlayers