Question

I have a map with a polyline and an animated symbol on the line. Just like the example that Google have here

https://developers.google.com/maps/documentation/javascript/examples/overlay-symbol-animate

Now I want to extract latitude and longitude of the animated symbol as it animates. I want to pan the map to the symbol so if the symbol is out of bound, the map automatically adjusts it self to show the animated symbol.

If there is any other work around to do this rather than getting the lat long points, do tell me.

Was it helpful?

Solution 2

The thing is you can't get the LatLng point from the animated symbol. I just discarded using the symbol and started using marker to animate along a polyline. This gives a lot more options, and you can do almost anything.

OTHER TIPS

I am not sure there is a latlng object available for the symbol.

By looking at the line object in the example you provided, it looks like only the offset attribute can be accessed. However, you can compute the position of the symbol from this value:

Example: http://jsfiddle.net/ZPkMq/

If your polyline is not a straight line, finding the position of the symbol may be slightly more complex (but doable - see place marker on polyline with specific distance)

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top