Unable to use the table #2 types with Google Places API

我的梦境 提交于 2019-12-04 20:27:26

First of all:

Keep in mind that you only can find a place that has been created by somebody. Also remember that the places-API is experimental.


I also didn't find any place of type neighborhood in Milan or London.

But I find them e.g. in Paris, New York, Washington, so you may test your application there.


What I realized while playing around with the API: When I define the range to search for by location and radius the results often are very inaccurate.

For example I search for a neighborhood starting by a point in radius of 5km, it will find a neighborhood in 4km but not in 400m.

The results are much more exactly when I search within LatLngBounds

What you are looking for are sublocality's, this can be confirmed through a Places Autocomplete API request:

Input "Fiera Campionaria" returns "Fiera Campionaria, Milano, Italia" with types "sublocality", "political", "geocode": https://maps.googleapis.com/maps/api/place/autocomplete/json?input=Fiera%20Campionaria&sensor=false&key=your_api_key

Input "Il Portello" returns "Il Portello, Milano, Italia" with types "sublocality", "political", "geocode": https://maps.googleapis.com/maps/api/place/autocomplete/json?input=Il%20Portello&sensor=false&key=your_api_key

Unfortunately a Places API Search request in this area with types specified as "sublocality|political|geocode" does not return these results: https://maps.googleapis.com/maps/api/place/search/json?location=45.47536640,9.15523110&radius=3000&sensor=false&types=sublocality|political|geocode&key=your_api_key

I have reported this Internally as a bug.

Cheers

Chris

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!