I'm not sure how to word that question, so I apologize for any trouble in understanding.
I've given Geocoordinates (Lat, Long) and a radius of N kilometers.
We've also given a database with documents containing geocoordinates.
Now my task is to check if any of those documents' coordinates is within the radius.
I'm not sure how I can check if the coordinates are in the radius or not. I saw that the Google Maps API supports reverse geocoding, but I couldn't really find anything usable.
I hope someone can help to get me in the right direction!
Edit: I'm using MongoDB to store my event documents (contains an array with the lat and long)
Related
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={}
I am developing a node.js app using express and mongodb.
I need to retrieve the latitudes and longitudes nearby a specific latitude and longitude.
I need to know what should I implement to do this.
Thanks,
Places API Nearby Search is a web service that returns information about places using HTTP requests, that is, available on Google Maps Platform. As per the documentation, this API will let you search for places within a specified latitude and longitude. You can refine your search request by supplying keywords or specifying the type of place you are searching for.
For example, you want to search for nearby restaurants within 1500m radius of a point near Sydney, Australia: https://maps.googleapis.com/maps/api/place/nearbysearch/json?location=-33.865111,151.196121&radius=1500&type=restaurant&key=YOUR_API_KEY
Here are the different Place Types you can use to refine your search request. Please note that you need to get an API key to use the API and here is how you can get one.
I hope this helps!
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.
ES newbie here.
I have an index of users with boundaries eg north, south, east, west. These boundaries are where they are willing to work. I also have their home address lat, lng and the radius of the circle that gives me the bounds.
I then want to search a given lat, lng and get results based on users that are prepared to travel to this location. EG, with their bounds.
Reading the docs, I can't see if this is currently possible. From my understanding I will need to do two searches (Or one search then filter).
• First do a geo_distance search with say 100miles from my lat, lng
• Then filter these results with a geo_bounding_box to see they fall into params.
It doesn't seem like a great way to go. Is there a better option? It is worth noting that a lot of these documents are new and I can easily reformat if needed.
Any suggestions on the right way to go about this?
Is there a filter I can use to see if my lat, lng are with the bounds?
Thanks in advance for your help. Cheers.
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.