How to find the most popular Foursquare venue in each category in a given city?
According to Foursquare API, Venues/Explore returns a list of recommended venues near the current location, Venues/Search returns a list of venues near the current location, optionally matching the search term. So in both cases, the return-list is the collection of venues near t开发者_Go百科he current location. Not the global collection for a given city. In this case, how does 'Plan my next trip' find the most suitable place for each category in a given city? Thanks!
You can send a geocodable string (such as the city name) as the near
parameter in the Search API, leaving the ll
(lat/long) parameter empty. This will search in the entire city and not rank results by distance to a specific point.
From the docs:
near Chicago, IL
required unless ll is provided. A string naming a place in the world. If the near string is not geocodable, returns a failed_geocode error. Otherwise, searches within the bounds of the geocode. Adds a geocode object to the response. (Required for query searches)
You can specify the latitude and the longitude using the ll parameter.
精彩评论