【问题标题】:Can I use Google Places API to return residential addresses?我可以使用 Google Places API 返回住宅地址吗?
【发布时间】:2016-09-15 12:41:33
【问题描述】:

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

我知道那里有数据,因为如果您在 Google 地图上搜索,或使用地理编码 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

【问题讨论】:

    标签: google-places-api


    【解决方案1】:

    使用带有type=geocodetype=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
    

    【讨论】:

    • 不,我试过自动完成。添加 types=address 不会给我任何不同的结果 - 它只返回道路,例如“英国伦敦辛克莱路”。
    • 尝试在此演示中检查“地址”:google-developers.appspot.com/maps/documentation/javascript/… ─ 您应该会看到仅建议地址,而没有建议商家。
    • 它仍在返回没有门牌号码的道路。与 OS Places Find API 进行比较,后者返回街道上各个门牌号的结果。
    猜你喜欢
    • 2015-09-18
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-12-30
    • 1970-01-01
    • 2012-12-21
    相关资源
    最近更新 更多