I'm working with open layer I have stumbled on a problem.
Here is what am I trying to achieve is to remove passed line, when the marker moves.
To explain a bit more, check bellow example:
https://openlayers.org/en/latest/examples/feature-move-animation.html
When clicking start animation, the marker moves, but the yellow line that marker passed by, is stayed, I would like to remove that line behind the marker when the marker moves.
How can that be done with OpenLayers?
Starting from the example referenced, one option would be to add a new line
Feature
, then update its coordinates to remove those which have already been traversedadd a new
Polyline
:add the new feature to the vector layer:
inside the moveFeature function, update the line's coordinates to remove those already traversed:
working example
code snippet: