Foursquare venues as areas, not points - foursquare

Venues in the Foursquare API seem to be simple coordinates. This means that all photos taken in a large venue like a university building can be collapsed down, and appear as if they were all taken at a single point.
Is there any way to figure out how large the Foursquare venue really is, so I know that a huge spike of photos at a specific point is really gathered from a larger area?
Foursquare doesn't seem to track such information, but perhaps someone else has mapped venues to buildings or bounding boxes.

There's actually fields in a venue details response that can give you a sense of a venue's size. Within the location object, we expose the radius50 and radius90 whose values are the radius from the center of the venue needed to encompass 50% and 90% of the check-ins at venue, respectably. For example, if radius50 had a value of 35, this means that half the check-ins to this place took place within the region 35m out from the venue's reported lat/lon.
While not a perfect measurement of size or a bounding box, this can definitely give you some insights. For example, comparing the radius50 and radius90 values for a restaurant and airport indicates that the airport is significantly larger than the restaurant.

Related

Foursquare API: how to explore venues within an administrative division such as ‘borough’

I am a beginner user of Foursquare API.
Most of the Foursquare techniques I learned so far is to do query such as search for or explore from a single location point (e.g. a café or a hotel) in a single geographical coordinate pair of longitude and latitude.
My question is, if it is possible to make an query to explore venues within an area, instead of in the vicinity of a single location point. By ‘an area’, I specifically mean the unit of the administrative division, such as a borough, of a neighbourhood.
In other words, my intending query, if possible, would start from an area specification of the administrative division of my interest (e.g. borough), such as its name or its border’s geographic coordinates—as a 'key' to link with Foursquare data, rather than start from a single location point.
I downloaded GeoJson file that already defined the geographical coordinates of the border of the administrative division of neighbourhoods in a city that I am interested in (link: http://cdn.buenosaires.gob.ar/datosabiertos/datasets/barrios/barrios.geojson). Just FYI, in this link, the neighbourhood is described as ‘barrio’ and the border is defined in the form of 'Polygon'.
I just wonder if I can use an area specification—either the name of an administrative division or a set of the geographic coordinates of an administrative division's border—as a key to make an query about venues such as restaurants, hospitals, and polices within the unit of an administrative division (e.g. borough) from corner to corner.
I guess that the underlying question is if Foursquare side has such info stored in somewhere in its system: if not, my contemplated approach would not work.
Or there might be a totally different workaround to achieve my goal.
If anyone can advise me on this matter, I would highly appreciate it.
Thanks
Given the parameters listed in the docs I think that the best approach would be to use the ll or near parameters and also include a radius so you can limit the search for a given area or region.
To get the middle point for the polygon I guess you would need to do some math but shouldn't be that difficult.
Besides this I think there doesn't seem to be any other parameter in Foursquare API to search by area or by a coordinates array (polygon).
Anyways, I would suggest that you go through the Foursquare API docs for both search and explore endpoints and check for yourself.
since you already have the polygon of interested region:
you could fit many small radius circles within to cover majority of the area.
this is not recommended as it may be rate limited or get you blacklisted but: the foursquare website has a 'draw' tool that allows you to draw a polygon and search venues within. (open networks tab under inspect in your browser and see request) I have noticed that it also can't take very complex polygons, no enclaves, and it further aggressively simplifies polygons to remove holes/dents/land bridges.
here's my demo requests. polygon search isn't strict and might show some venues outside the border.
the url:
https://foursquare.com/explore?mode=url&polygon=35.957999786220704%2C-80.41236877441406%3B35.897393965545646%2C-80.38215637207031%3B35.87847989454576%2C-80.55107116699219%3B35.954664894270834%2C-80.54901123046875%3B35.994118756097%2C-80.386962890625%3B35.957999786220704%2C-80.41236877441406
the corresponding get for venues:
https://api.foursquare.com/v2/search/recommendations?locale=en&explicit-lang=false&v=20210302&m=foursquare&limit=30&intent=bestnearby&polygon=40.8252411857252%2C-74.00630950927733%3B40.817446884558805%2C-73.99772644042969%3B40.81147063339219%2C-73.99875640869139%3B40.80757278825516%2C-74.00768280029297%3B40.80887209540822%2C-74.01729583740234%3B40.81406906961218%2C-74.02175903320312%3B40.8197852710803%2C-74.02210235595702%3B40.826280356677124%2C-74.01695251464844%3B40.8252411857252%2C-74.00630950927733&wsid={}&oauth_token={}

Foursquare nearest venue search sorting

When I wanted to check in, I noticed that Swarm doesn't sort venues based on distance alone. Closer venues can (somehow) end up lower in the list. Yet my current venue mysteriously appears on the top even if it's not the closest one.
I'm currently implementing SQL-backed cache on top of the Foursquare API (so that I don't have to call the API too often) and need to replicate this behavior.
When I issue API venue/search request with intent=checkin, the correct venue pops out on top right away. But when I do a distance-sorted search in my database (with identical data), the outcome is imprecise and thus unacceptable.
Does anybody have any thoughts on this matter? What algorithm might Swarm be using to achieve this kind of precision given only a location and the accuracy of measurement?

Cannot find restaurant using /venue/search end-point

Question to Foursquare engineers :) Could you please explain to me why I cannot find restaurant using /venue/search end-point ?
Restaurant in question is Aqua in San Francisco. According to /venue/ID request restaurant location is 37.793489,-122.399905. So I'm calling /venue/search request with intent=checkin with exactly these coordinates.
https://api.foursquare.com/v2/venues/search?v=20130712&ll=37.793489,-122.399905&categoryId=4d4b7105d754a06374d81259,4d4b7105d754a06376d81259&intent=checkin&radius=100&oauth_token=QEJ4AQPTMMNB413HGNZ5YDMJSHTOHZHMLZCAQCCLXIX41OMP
API returns me 30 items with no Aqua in it. Where as in documentation it says:
Unlike the checkin intent, browse searches an entire region instead of only finding Venues closest to a point.
So then why doesn't it return items sorted by the distance from the point I provided?
If I change intent to browse I'll get "Aqua" in results.
Basically behavior looks inconsistent. How can I make it more reliable ?
It looks like this is happening because this isn't a venue that Foursquare thinks you're likely to check in at. Given your lat/lon and radius, Foursquare thinks that you're more likely to check in to the 30 results you see than the restaurant you have in mind.
However, if you either reduce the radius or increase the number of results, you'll find the restaurant in question.

Free venues database which is up-to-date and accurate and allows querying against wide regions?

Is there a free database for venues (such as cinemas, restaurants, cafes, schools, etc.) which have attributes for the venues such as geographic coordinates, name, contact info, address, type or category, etc.
I know that there are alternatives like Foursquare Venues Platform. But Foursquare Venues Platform have limits on the number of results per request and square measure of the bounding box.
I need to get a collection of venues on a large area.
You should check out GeoNames (www.geonames.org)
It is not a perfect fit for what you are asking, but they do have a downloadable (free or paid) database of locations.
You can import it and then get as much data as you want.
It contains a lot of data, but we found that there is a lot of work to be done cleaning it up (we were using the free version)
Maybe the paid will have less noise.
Do note, that it will not be as complete as what Foursquare or Google places or Facebook has to offer, but if you need to query a large area with many results, it might fit your needs.
They also have an API (Web Services).

Query Venue Tips at a greater Distance

i want to query Venue Tips for specific keywords at a larger distance. currently when i do a query the distance is usually between 40-80 kilometers, however if i wanted to calculate a whole country I'd have to do multiple queries.
I've been singling out a particularly created by me in my hometown and adapting the lat and long coordinates, (+/- 40-80 Kilometers) it looks like the distance radius is not uniform, some kind of clusters fundamental to the foursquare data structure.
if i wanted to do a complete search for a country i'd have to define multiple points and hope that i include all of the desired area, also if the the resultset is larger than 500 i'd have to again divide the area to get results on a more granular basis.
my question basically is whether my approach is right or for anyone to provide additional hints
thx in advance.
There's no way to search tips in that large of a area at the moment. That being said, the foursquare venue search behavior is constantly evolving so it's not inconceivable that a larger radius may someday be supported.
If you're building a user application, maybe you can show them a map and let them drag a pin around which then recenters where they're searching.
The maximum supported radius is currently 100,000 meters. That's already a bit more than the 40-80 kilometers you mentioned.

Resources