我想使用 html5 地理位置获取用户位置信息,如城市、地区等,我尝试了下面的文章,但是我得到了纬度和经度,我想获取城市和地区信息, http://www.dotnetcurry.com /ShowArticle.aspx?ID=782
问问题
1811 次
1 回答
0
当您获得用户的位置后,您需要进行反向地理编码以获取有关位置的信息,例如城市等。
查看Google Maps的反向地理编码 API 。
navigator.geolocation.getCurrentPosition(function(pos){
var latlng = new google.maps.LatLng(pos.coords.latitude, pos.coords.longitude);
geocoder.geocode({'latLng': latlng}, function(results, status) {
console.log(results);
// Analyze results and find the info you need.
});
});
查看如何在不使用 Google 的情况下反向地理编码,了解有关不使用 Google 地图的地理编码的信息。
于 2013-02-11T07:11:44.603 回答