Google Maps JS API-查找给定位置(纬度/经度)的地点的名称
鉴于纬度/经度,我如何使用该位置来获取该位置的地点的名称Google Map的JS API?
Given a latitude/longitude, how can I get the name of the place at that location using Google Map's JS API?
Geocoder.geocode(..)
似乎是可行的方法,但是不确定从API结果中获取确切位置名称的最佳方法是什么.
The Geocoder.geocode(..)
seems to be the way to go, but am not sure what's the best way to get the exact location name out of the API results.
使用地理编码API将位置映射到地址,并将地址映射到位置. http://code.google.com/apis/maps/documentation/javascript/services.html#Geocoding
Use the Geocoding API for mapping locations to addresses and addresses to locations. http://code.google.com/apis/maps/documentation/javascript/services.html#Geocoding
Geocoder.geocode( { 'latLng': latLngObject }, callback);
回调函数接收结果和状态.
The callback receives results and status.
结果非常准确,但是您仍然必须依靠近似值,因为很少能准确地测量用户位置.
The results are pretty accurate, but you'll have to rely on approximations nevertheless, as the user location can rarely be measured exactly.