【发布时间】:2017-05-25 09:28:42
【问题描述】:
如何使用 google places api 在 android 中通过 latLng 获取 place 或 placeid? 当我得到 latLng 时,我想得到 place 或 placeid
【问题讨论】:
标签: android google-maps google-places-api
如何使用 google places api 在 android 中通过 latLng 获取 place 或 placeid? 当我得到 latLng 时,我想得到 place 或 placeid
【问题讨论】:
标签: android google-maps google-places-api
您可以使用此 Google Maps API
http://maps.googleapis.com/maps/api/geocode/json?latlng=23.00,72.57&sensor=true
【讨论】:
我已经使用这种方式在我的应用程序中实现了
https://maps.googleapis.com/maps/api/geocode/json?latlng=21.1702401,72.8310607&key=YOUR_API_KEY
你会得到这样的响应,其中包含 place_id。
{
"results" : [
{
"address_components" : [
//It contains postal code and details
],
"formatted_address" : "22 Demart, Surat, India,
"geometry" : {
"location" : {
"lat" : 21.1702401,
"lng" : 72.8310607
},
"location_type" : "ROOFTOP",
"viewport" : {
"northeast" : {
"lat" : 21.1702401,
"lng" : 72.8310607
},
"southwest" : {
"lat" : 21.1702401,
"lng" : 72.8310607
}
}
},
"place_id" : "ChIJd8BlQ2BZwokRAFUEcm_qrcA",
"types" : [ "street_address" ]
},
... Additional results truncated in this example[] ...
],
"status" : "OK"
}
你也可以参考这个链接
https://developers.google.com/maps/documentation/geocoding/start
希望这对你有帮助..如果有任何问题,你可以问
【讨论】:
两种建议的方式 - 都需要花钱,我认为人们应该提到它。是的,我们有来自 Google 的 -$200,但这完全取决于您拥有多少用户以及您需要使用地理编码器的频率。每月向地理编码器发出 60k 次请求 - 只需 300 美元即可使用地理编码器:
2018 年 11 月 1 日至 30 日 地理编码 API 地理编码:6073 次 - 30.38 美元
不要像我们在其他帖子的请求中那样过滤您在回复中需要的内容?期待更多:
2018 年 11 月 1 日至 30 日 Places API Places 详细信息:2389 计数 $40.61
2018 年 11 月 1 日至 30 日 Places API 联系数据:2385 计数 $7.17
2018 年 11 月 1 日至 30 日 Places API Atmosphere 数据:2385 个,计 11.95 美元
【讨论】: