How to get GPOINT by City in Google Maps API Javascript
I have the string - "Moscow".
How to get a Gpoint (coords) from the my string?
I n开发者_StackOverfloweed result about : new GPoint(30.3112,59.99322);
Well, v2 API says that GPoint does not represent a point on Earth by geographical coordinates but GLatLng does.
To get coordinates you need to use geocoding:
geocoder = new GClientGeocoder();
geocoder.getLatLng("Moscow", function(point)
{
if (point == null)
{
// nothing found
}
else
{
// point is an instance of GLatLng with coordinates you need
}
});
The Google Geocoding API will do the job for you, description and examples here: http://code.google.com/apis/maps/documentation/geocoding/
精彩评论