google-places-api - 我可以使用 Google Places API 返回住宅地址吗?

标签 google-places-api

我们有一个应用程序,用户可以在其中报告事件并希望允许按关键字进行搜索。 Google Places API(我尝试了附近搜索、文本搜索和自动完成)只返回商家,但有时用户可能在住宅街道上。如何让 Places 返回住址?

我知道数据在那里,因为如果你在谷歌地图上搜索,或者使用地理编码 API,你可以获得一个准确的地址。

示例(在伦敦随机选取一个点):
https://maps.googleapis.com/maps/api/place/nearbysearch/json?&key=[YOUR_KEY]&radius=50000&location=51.611499,-0.026750&keyword=sinclair

返回

Sinclair Pharma, 1st Floor Whitfield Court, 30-32 Whitfield Street, London
Sinclair Pharmaceuticals Ltd, Godalming Business Centre, Woolsack Way, Godalming
Sinclair Hammelton Bromley, 23 High Street, Bromley
Sinclair & Rush Ltd, 20 / 20 Business Estate, Spectrum West, Saint Laurence Avenue, Maidstone
Sinclair Hammelton Petts Wood, 9 Fairway, Orpington
Sinclair Till Flooring Co Ltd, 793 Wandsworth Road, London
etc



https://maps.googleapis.com/maps/api/geocode/json?&key=[YOUR_KEY]&latlng=51.611499,-0.026750

返回
148 Sinclair Rd, London E4 8PR, UK

最佳答案

是否对 type=geocode 使用自动完成功能或 type=address做你想做的事(link to docs)?

https://maps.googleapis.com/maps/api/place/autocomplete/json?&key=[YOUR=KEY]&type=geocode&radius=50000&location=51.611499,-0.026750&input=5%20sinclair

关于google-places-api - 我可以使用 Google Places API 返回住宅地址吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39511330/

相关文章:

android - Google place API for android 查找城市

Android Studio 说地方 api 未启用

google-maps - 无法从 Google Places API 获取特殊营业时间

geolocation - 如何在给定坐标的情况下评估位置的偏远程度?

Android Place API : PlaceDetectionApi. getCurrentPlace() 始终不返回任何结果

javascript - 如何将谷歌自动完成地点限制为N个国家?

android - android中的PlaceAutoCompleteFragment在输入第一个字母后不显示建议并关闭

javascript - 无效值错误: not an instance of HTMLInputElement

ios - 从 google places api 获取附近的地方。收到错误提供的 API key 无效

android - 如何实现 PlaceAutocompleteFragment 和 PlaceAutocompleteActivity 以获取地点详细信息