Foursquare的API:获取给定区域内场地的详尽清单 [英] Foursquare API: Getting an exhaustive list of venues in a given area

查看:167
本文介绍了Foursquare的API:获取给定区域内场地的详尽清单的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用Foursquare的API来获取某一类场馆的名单。
一个重要的要求是,该列表是详尽的,即包括所有相关的点。第2版​​/场地/搜索API的端点强制执行对输出50场地的限制。
这样想到的第一个想法是分裂区域分成若干段(使用SW和NEPARAMS),然后结合的结果。

I'm using Foursquare API to get a list of venues of a certain category. One important requirement is that the list is exhaustive, i.e. includes all relevant points. The v2/venues/search API endpoint enforces a limit of 50 venues on the output. So the first idea that comes to mind is splitting the area into several sections (using "sw" and "ne" params) and then combining the results.

显然,点的密度会显着变化取决于位置,所以我们需要使用某种自适应算法,可以灵活地调整搜索窗口的大小,使其包含所有点。此外,还有跑入速率限制的风险增加,因此,我们可能需要算法停止时,它的使用了它的请求配额。

Clearly, the density of points will vary dramatically depending on location, so we'll need to use some kind of adaptive algorithm to flexibly adjust the size of the search window so that it contains all points. Also, there's an increased risk of running into the rate limit, so we might need the algorithm to stop when it's used up its quota of requests.

最后,似乎要告诉的唯一方式,如果一个搜索窗口应进一步缩水是计算结果中的点数:如果我们有小于50,那么我们已经有了一个完整列表,此部,并且可以在移动到下一个;否则,我们应进一步分裂它。这似乎是浪费,因为我们会被扔掉的中间结果(即所有的结果在我们的搜索树除叶)。

Finally, it seems that the only way to tell if a search window should be shrunk even further is to count the number of points in the result: if we have less than 50, then we've got a complete list for this section and can move on to the next one; otherwise, we should split it further. It seems to be wasteful as we'll be throwing away the intermediate results (i.e. all results in our search tree except for the leaves).

因此​​,这里有一些问题,我有:

So here are some questions that I have:


  • 是不是拼凑一个详尽的清单的最佳方式?也许我
    缺少一些API功能?

  • 是否有你在这种情况下,使用任何特定的算法?

  • 您会如何去减少不得不被扔掉的结果数量?

在此先感谢!

推荐答案

一个重要的声明将是四方的,当你在同一区域进行大量的搜索不喜欢它。

说了这么多,你应该考虑在会场搜索API的categoryId过滤实验。大多数在Foursquare上的数据是食品(餐厅)和夜生活有关。

Having said that, you should look into experimenting with categoryId filter in the venue search api. Most of the data on foursquare is food (restaurants) and nightlife related.

所以,如果你排除这些(包括由其他人,没办法排除),你可以在更大的区域搜索,仍然可以得到低于50的结果。

So if you exclude these (by including others, no way to exclude) you can search on a larger area and still get below 50 results.

从来没有真正尝试过使用这种算法,因为过滤的categoryId工作不够好,但在理论上,算法简单,每个纬度/经度0.001为〜111米。

Never really tried using such an algorithm because the categoryId filtering worked good enough, but in theory, the algorithm is simple, each lat/lng 0.001 is ~111 meters.

使用小半径(〜200大都市地区)搜索和三角测量(扫描)区域。

Search using a small radius (~200 for large metropolitan areas) and triangulate (scan) areas.

是什么让我们原来执行了大量的搜索(后来停止这样做)的是,有时候四角筛选出的结果,而不问你(对我来说,它看起来像虫子,他们的算法的一部分)。例如,我会寻找在50米半径内,找到我想要的(我知道我搜索)的地方,扩大到500米,找不到它(并获得少于50个结果 - 所以它不是下降了,因为我打的上限,它已被删除,因为???),我的移动搜索位置〜北300米,找到它 - >零星行为

What got us to originally perform a lot of searches (and later stop doing so) is that sometimes foursquare filter out results without asking you (for me, it looks like bugs, for them its part of the algorithm). So for example I would search on a 50 meter radius, find the place I want (I know what I am searching for), expand to 500 meters, not find it (and get less than 50 results - so it was not dropped out because I hit the cap, it was dropped out because ???), move my search location ~300 meters north, find it -> sporadic behavior.

我的观点是(以及为什么我们停止了许多搜索和改变了我们的方法的原因),你要实现的目标是什么,'全覆盖'是的非常的很难​​办授予当前API和当前使用政策,和 - >它并不重要真的。与它打了几个月后,我们想通了,我们应该查询什么的用户都在寻找,并要求在这一刻foursqaure,我们缓存结果 - 随着时间的推移,我们将有一个完整的覆盖,也许在开始,我们将错过几个景点,但是从长远来看,它不是真的很重要。

My point is (and the reason for why we stopped making a lot of searches and changed our approach), what you are trying to achieve, 'complete coverage' is very hard to do given the current API and the current usage policy, and -> it is not important really. After a few months of playing with it, we figured out that we should query foursqaure for what our users are looking for and require at this moment, we cache the results - over time we will have a complete coverage, maybe at start we will miss a few spots, but for the long run its not really important.

这篇关于Foursquare的API:获取给定区域内场地的详尽清单的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆