我如何获得更多地点? [英] How do I get more locations?

查看:150
本文介绍了我如何获得更多地点?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用以下API调用使用FourSquare API在纽约获得一些位置:

I am trying to get some locations in New York using FourSquare API using the following API call:


https:// api。 foursquare.com/v2/venues/search?ll=40.7,-74&limit=50

https://api.foursquare.com/v2/venues/search?ll=40.7,-74&limit=50

我不明白的是如果呼叫限制了50个搜索结果(这是最大值),我怎样才能获得更多位置?使用Facebook API时,返回的结果是随机的,因此我可以发出多个调用以获得更多结果,但FourSquare似乎返回相同的结果集。有没有更好的方法来获得更多的位置?

What I don't understand is that if the call imposes a limit of 50 search results (which is the maximum), how can I get more locations? When using Facebook API, the results being returned were random so I could issue multiple calls to get more results but FourSquare seems to be returning the same result set. Is there a good way to get more locations?

编辑:

确定。所以有评论说我可以违反合同协议,我不知道为什么会这样。我很乐意接受这个推理。我的疑问是这样的:让我们假设,我要搜索的位置不在50个结果中?在这种情况下,不应该在某处有分页机制吗?

Ok. So there was a comment saying that I could be breaking a contractual agreement and I am not sure why this would be the case. I would gladly accept a reasoning for this. My doubt is this: Let us say that hypothetically, the location I am searching for is not in the 50 results returned? In that case, shouldn't there be a pagination mechanism somewhere?

推荐答案

API docs 这里可以提供帮助。

The API docs here can help.

Foursquare搜索非常紧密地联系在一起到您提供的位置'point'(查询中的'll'参数)。简单的答案是,要在给定区域内找到更多场地,您需要再次使用该区域内的不同位置点进行查询。

Foursquare searching is very closely linked to the location 'point' (the 'll' param on the query) that you provide. The simple answer is that to find more venues within a given area, you need to simply query again with a different location 'point' within that area.

两个查询,两个在彼此接近的点:

Two queries, both at points close to one another:

https://api.foursquare.com/v2/venues/search?ll=40.700,-74.000&limit=50
https://api.foursquare.com/v2/venues/search?ll=40.705,-74.005&limit=50

将为您提供两组不同的场地(可能会重叠,具体取决于积分的接近程度)。

will get you two different sets of venues (that may overlap, depending on how close the points are).

搜索方法的默认意图是'checkin',它将返回最接近该点的50个最受欢迎的位置。如果您想要查看区域内的所有场地,可以使用浏览意图。这需要一个'radius'参数,在这种情况下,它返回给定半径周围给定点的圆内的场地,或者它需要两个坐标代表矩形的'sw'和'ne'角。所以,你可以这样做:

The default intent for the search method is 'checkin', which will return the 50 most popular locations closest to that point. If instead you want to look at all the venues within an area, you can use the 'browse' intent. This takes either a 'radius' parameter, in which case it returns venues inside a circle around the given point with the given radius, or it takes two coordinates representing the 'sw' and 'ne' corners of a rectangle. So, you could do:

https://api.foursquare.com/v2/venues/search?ll=40.705,-74.005&limit=50&intent=browse&radius=50

这将为您提供50个场地在该点附近的50米圈内。较小的半径将减少返回的场地数量。因此,通过改变搜索的半径和点(或'sw'和'ne'参数描述的矩形的大小和位置),您可以获得更多的场地。

which will give you 50 venues within the 50m circle around that point. A smaller radius will reduce the number of venues returned. So, by varying the radius and the point at which you search (or the size and position of the rectangle described by the 'sw' and 'ne' parameters), you can get more venues returned.

希望有所帮助。

这篇关于我如何获得更多地点?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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