开发者

Embed google map using longitude and latitude

I would like to embed Google Map into my website, and I'm passing over 2 parameters, "longtitude" and "latitude".

开发者_如何学Python

Any possible way the map will change according to the longitude and latitude I sent in? For example, I put in 3.1019924,101.4804983 and click on "Search map" on maps.google.com I will get the location and the embed code.

How can I do it in a way I have already embed the map, just passing in the data?


You need to use the Google API. http://code.google.com/apis/maps/documentation/javascript/


Sounds like you already have the Google Maps javascript Google Maps object in your page, so you just need to center the map given a location.

To do this you need to call the panTo method on your google.maps.Map object. You pass a google.maps.LatLng object as a parameter and it will center the map on that location:

yourMap.panTo(new google.maps.LatLng(lat, lng));
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜