Google Maps JS API-查找给定位置(纬度/经度)的地点的名称 [英] Google Maps JS API - Find name of place given location (latitude/longitude)

查看:60
本文介绍了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.

这篇关于Google Maps JS API-查找给定位置(纬度/经度)的地点的名称的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆