2016-09-15 115 views
2

我们有一个应用程序,用户可以报告事件并希望允许按关键字搜索。 Google Places API(我试过附近的搜索,文本搜索和自动完成功能)仅返回商家信息,但有时用户可能在住宅街道上。我如何让地点返回住址?我可以使用Google Places API返回住宅地址吗?

我知道数据在那里,因为如果您在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 

回答

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 
+0

不,我试过自动完成。添加types = address不会给我任何不同的结果 - 它只返回道路,例如“英国伦敦辛克莱路”。 –

+0

请尝试检查此演示中的“地址”:https://google-developers.appspot.com/maps/documentation/javascript/examples/full/places-autocomplete─您应该看到仅建议了地址,并且没有任何商家。 – miguev

+0

它仍然没有门牌号返回道路。与OS Places Find API比较,该API返回街道上各个房屋号码的结果。 –

相关问题