开发者

GeoLocation + Google Maps API?

i want to use the GeoLocation watchPosition command, to get location data on a p开发者_开发问答hone. With these coords, I want to draw a route in a google map, which updates with every new coord i get into an array with coords.

any advice how i can achieve this?

thanks in advance.


I'm currently working on creating a map page that does something very similar. I fire off watchPosition and then take the coords from the returned results and pass them into the a DirectionsRenderer object that I call the first time. I take this DirectionsRenderer object and store it in an array. Then with every updated coords, I update the Lat/Lng values in the object with the new coords. This seems to work pretty well.

You can see an example of my code here. The functionality is not perfect, but it works pretty well. See the getUserLocation function for details.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜