I'm really new to JS, sorry I don't have my code, because all I have done are helloworld examples from Google Map Docs.
So what's the problem: I want to draw a polyline depending on the current position of the user. So, every google.maps.LatLng () should have coordinates at the moment. The entire update path should appear on the map, for example, once in 5 seconds. Finally, it’s just like visualizing a morning walk on a map, something like that.
I know how to “draw” a map and add points to var flightPlanCoordinates [], and I ask for some examples or links where I can find:
- How to add current position to var flightPlanCoordinates []
- How to do all this update in live mode
Thanks for any help :)
UPD:
trying to do something like this but not working
var path = poly.getPath(); var latitude = position.coords.latitude; var longitude = position.coords.longitude; path.push(new google.maps.LatLng(latitude, longitude));
UPD2: here's a cool example of how it should be http://kasheftin.imtqy.com/gmaps/
javascript html5 google-maps google-polyline
Rachnog
source share