Search code examples
apiurllib2foursquare

Why is the Foursquare API only generating results for certain coordinates?


I am using the Foursquare API to read JSON pages filled with the trending venues in areas. I tried generating a link as they explain to, but venues are only returned for the coordinates, 40.7, -74 – the ones they give as an example on their site. This can be seen using their API Explorer:

The trending restaurants are returned for the coordinates they give as an example, as can be seen at this link: https://developer.foursquare.com/docs/explore#req=venues/trending%3Fll%3D40.7,-74

But trying coordinates for San Francisco, for instance – 37.755516, -122.44812 – doesn't return anything, although it also doesn't show an error: https://developer.foursquare.com/docs/explore#req=venues/trending%3Fll%3D37.755516,-122.44812

I tried both links with my own Client ID and Client Secret outside of the explorer, but again I only got results for 40.7, -74. This leads me to believe that it must be the coordinates I'm giving it, although I cannot figure out why.

Many thanks in advance.


Solution

  • Not all points have trending venues nearby. If the check-in volume in the area is low, or no venues are especially busy at the moment, there will be no trending venues.

    Here is a spot in San Francisco that, at the time of this writing, has trending venues: https://developer.foursquare.com/docs/explore#req=venues/trending%3Fll%3D37.786793,-122.405211

    You can try increasing the "radius" parameter to capture more trending venues nearby. Here is an example of your query with a higher radius, so it captures more venues: https://developer.foursquare.com/docs/explore#req=venues/trending%3Fll%3D37.755516,-122.44812%26radius%3D20000