I want to select particular city on google map but I cant find the way.
feedback
|
migrated from stackoverflow.com Dec 1 '09 at 18:38
This question came from our site for professional and enthusiast programmers.
|
Assuming you have the latitude and longitude (31.2 and 121.5 in this example) You need to call setCenter on the GMap2 object (for Google Maps version 2.*):
If you don't have the latitude and longitude for the particular city (and want it to work for any city name), then you need to use the Geocoding to map from a name to a latitude longitude. To do this you need to have a look at the documentation for the GClientGeocoder object. You will need to call getLocations, passing in a string containing the city name you are after. Once you get your asynchronous response back with a latitude, longitude, you can set the center of your map at that position. You can find an example of geocoding several city names here. | |||
|
feedback
|