How do I get more locations?

后端 未结 2 1928
南旧
南旧 2021-01-23 18:26

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,

2条回答
  •  时光说笑
    2021-01-23 19:13

    The API docs here can help.

    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).

    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
    

    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.

    Hope that helps.

提交回复
热议问题