tags:

views:

38

answers:

2

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

Any possible way the map will change according to the longtitude 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?

A: 

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

Andrew Cooper
A: 

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));
Cannonade