开发者

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/

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜