How do I get more locations?

后端 未结 2 1930
南旧
南旧 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.

    0 讨论(0)
  • 2021-01-23 19:15

    The current API limits results to 50. You should try altering your coordinates to be more precise to avoid not finding your venue.

    Pagination would be nice but 50 is a lot of venues for a search.

    0 讨论(0)
提交回复
热议问题