我们有一个应用程序,用户可以报告事件并希望允许按关键字进行搜索。 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
答案 0 :(得分:1)
使用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