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

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={}

Related

Spatial analysis to find nearby public transit options given a longitude/latitude and radius?

I recently used foursquare's API to get a list of venues nearby a given region, and it looks like it's returned mostly commercial businesses like restaurants, pubs, gyms, and cafes.
I was wondering if it were possible to add "public transit" to the list, for instance, the number of bus stops nearby.
As an example, here's an image of a map I created using folium (in python) and foursquare API to find restaurants in a radius near a long/lat.
Highlighted in the blue, you can see nearby venues to a longitude/latitude I provided, and also the description of one of these venues in the white box.
Circled in red are what appear to be public transit options, though these are not picked up in my analysis.
I was wondering if there were some API or dataset that I could use to pick up on these bus-stops/train-stops too?
Thanks!
I would try OpenStreetMap.
If you are using default base layer in this Folium map, it comes from OpenStreetMaps data too, so you should get exactly the bus stops you see here.

How do I select walls along a particular axis, among all the other walls, in Revit using the Revit API?

I want to change the height of all walls but the length of walls only in a particular axis, for instance, along the x-axis.
Consecutively, could you also tell how I could alter the similar dimensions for a house? Where there are connected walls?
I see nothing in this code that means it does not work.
However, it seems to me that it does not make much sense.
One would seldom constrain all wall heights to be user defined to a certain value; instead, in most Revit models, walls are constrained to reach from a bottom level to a top level. Then, if the height of all walls needs to be modified, you would modify the elevation of the top level only.
The logic of the code guarantees that the wall location line will only be modified if the newWallLine equals XYZ.BasisX. This may never be the case, since the line is a Line object and the vector an XYZ.
I would recommend researching exactly what you wish you achieve and how to do so manually in the end user interface before addressing the task programmatically.
In general, if a feature is not available in the Revit product manually through the user interface, then the Revit API will not provide it either.
You should therefore research the optimal workflow and best practices to address your task at hand manually through the user interface first.
To do so, please discuss and analyse it with an experienced application engineer, product usage expert, or product support.
Once you have got that part sorted out, it is time to step up into the programming environment.
I hope this clarifies.

Finding all geohashes within two bounding coordinates

I have coordinates, which are assigned a corresponding geohash in my database. Now I want to retrieve all of the coordinates within two bounding coordinates (top right and top left corner). How can I do that properly?
I tried getting the geohash that fits both of those bounding coordinates, but this solution does not work when they are in completely different regions of the world (so they are not sharing anything in common).
Is there a better way to do that?
Thanks for your help
Unfortunately, this isn't something you can do out-of-the-box with datastore / App engine. (There are no built in spatial queries.)
For early prototyping, etc., you can do it the hard way - retrieve all the rows, and discard the ones not meeting your query in code. Obviously, probably not viable with real production data.
See related question Query for Entities Nearby with Geopt for some possible production solutions.

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?

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