我需要知道在Meteor js中使用纬度和经度来获取地区(城市,州和国家)。你能建议我为此做些什么吗?
先谢谢。
答案 0 :(得分:2)
你可以尝试像这样制作smth:
HTTP.call("get", "http://nominatim.openstreetmap.org/reverse?format=json&lat=" + SOME_LAT + "&lon=" + SOME_LNG + "&addressdetails=1", function(error, result) {
if (!error) {
//parse result
} else {
throw new Meteor.Error("...");
}
});
响应:
{
"place_id": "2573424409",
"licence": "Data © OpenStreetMap contributors, ODbL 1.0. http://www.openstreetmap.org/copyright",
"osm_type": "way",
"osm_id": "330047765",
"lat": "46.46377035",
"lon": "30.73842925",
"display_name": "1 к1, Волзький провулок, Odessa, Prymors'kyi Rayon, Odessa, Odessa Oblast, 65007, Ukraine",
"address": {
"house_number": "1 к1",
"road": "Волзький провулок",
"city": "Odessa",
"county": "Prymors'kyi Rayon",
"state": "Odessa Oblast",
"postcode": "65007",
"country": "Ukraine",
"country_code": "ua"
}
}