无法将表 #2 类型与 Google Places API 一起使用

发布于 2025-01-08 06:42:29 字数 591 浏览 0 评论 0 原文

当我使用 types=transit_station|neighborhood(或此处表 2 中包含的任何其他类型:http://code.google.com/apis/maps/documentation/places/supported_types.html#table2

显然,这与特定位置无关(我已经尝试过米兰,意大利和英国伦敦),所以我想知道我是否做错了什么,或者 API 目前是否未按预期工作

如果上述没有解决方案,如果有其他方法,我会非常高兴。查找建筑物的邻居(例如,在此地图中: http://g.co/maps/hfdke 我希望能够找到“Fiera Campionaria”、“Il Portello”等)。

I am unable to get any results with the Places API when I use a types=transit_station|neighborhood (or any other type included in the table 2 here: http://code.google.com/apis/maps/documentation/places/supported_types.html#table2

Apparently, this is not related to a specific location (I've tried both Milan, Italy and London, GB), so I'm wondering if I'm doing something wrong or if the API is not currently working as expected.

If the above has no solution, I'd be very happy if there was another way of finding the neighborhood of a building (for instance, in this map: http://g.co/maps/hfdke I'd like to be able to find "Fiera Campionaria", "Il Portello" etc).

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

星星的軌跡 2025-01-15 06:42:29

您正在寻找的是子地区,这可以通过地点自动完成 API 请求进行确认:

输入“Fiera Campionaria”返回“Fiera Campionaria,米兰,意大利”,类型为“子地区”,“政治”,“地理代码”:
https://maps .googleapis.com/maps/api/place/autocomplete/json?input=Fiera%20Campionaria&sensor=false&key=your_api_key

输入“Il Portello”返回“Il Portello,米兰,意大利”,类型为“sublocality”、“political”、“geocode”:
https://maps .googleapis.com/maps/api/place/autocomplete/json?input=Il%20Portello&sensor=false&key=your_api_key

不幸的是,Places API此区域中类型指定为“sublocality|political|geocode”的搜索请求不会返回以下结果:
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

我已在内部将此报告为错误。

干杯

克里斯

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

柳若烟 2025-01-15 06:42:29

首先:

请记住,您只能找到由某人创建的地方。
另请记住,places-API 是实验性的。


我在米兰或伦敦也没有找到任何类型的社区。

但我在巴黎、纽约、华盛顿等地找到了它们,所以你可以在那里测试你的应用程序。


我在使用 API 时意识到:
当我定义按位置和半径搜索的范围时,结果通常非常不准确。

例如,我搜索从半径为 5km 的点开始的邻域,它将找到 4km 内的邻域,但不会找到 400m 内的邻域。

当我在 LatLngBounds 中搜索时,结果更加准确

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

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文