如何使用 Foursquare/任何其他免费 API 按纬度和经度准确查找地点?
我正在尝试使用 Foursquare API 查找用户的位置。
问题是,它的数据库非常有限,所以有时它会返回最近的位置,可能在 100 米之外。如果用户在公园或任何其他面积较大的地方,则可能是正确的。但如果用户距离一家小咖啡馆 100 米,那么它就完全不正确。
有没有什么方法可以仅使用 Foursquare 来检查用户是否确实在某个地方的领土内?我还可以使用哪些其他免费地理定位 API 来获得准确的结果?
我尝试尝试并按距离对结果列表进行排序 - 但这没有多大帮助。我还检查了 Foursquare 提供的某个地方的所有信息。我希望找到一些有关某个位置区域的信息,这将非常有帮助 - 但没有找到任何信息。
I'm trying to find user's location using Foursquare API.
The thing is, its database is quite limited, so sometimes it returns the nearest place which might be 100 meters away. It might be correct if a user is at the park or any other place with huge area. But it will be completely incorrect if a user is 100 meters away from a small cafe for exapmle.
Is there any way to check if a user is really withing the territory of a place using only Foursquare? What other free geolocation API I can use to get accurate results?
I tried to play around and sort the list of the results by distance - it didn't help much. Also I checked all information about a certain place Foursquare provides. I hoped to find some information about the area of a location which would be really helpful - didn't find anything.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我认为 Foursquare 的局限性来自于他们更关注感兴趣的地方而不是通用的反向地理编码。因此,如果您的主要目标是准确性,我建议您研究地理编码/反向地理编码 API。
大多数地理编码提供商都有免费套餐,因此根据您发出的请求数量,您可以保持免费使用。检查例如:Here.com、OpenCage,或 TomTom。 OpenStreetMap 的 Nominatim 甚至可以免费用于非商业用途。
[免责声明:自我推销,我为 Superface 工作] 我们编写了这些提供商的比较,如果如果您使用的是 Node.js,我们还有一个 SDK,它为所有这些(以及其他 API)提供了统一的接口。反向地理编码的用法如下所示:
还有其他通用(反向)地理编码库,例如 node-geocoder< /a> 和 geopy 用于 Python。
I assume Foursquare's limitation comes from the fact they are more focused on places of interest rather than generic reverse geocoding. So if you are primarily aiming at accuracy, I recommend looking into geocoding / reverse geocoding APIs.
Most geocoding providers have a free tier, so depending on how many requests you make, you can stay within the free usage. Check for example: Here.com, OpenCage, or TomTom. Nominatim by OpenStreetMap is even free for non-commercial use.
[Disclaimer: self-promo, I work for Superface] We wrote a comparison of these providers, and if you are using Node.js, we have also an SDK which provides a unified interface for all of them (and other APIs). The usage for reverse geocoding looks like this:
There are other generic (reverse) geocoding libraries, like node-geocoder and geopy for Python.