Getting the list of Points of Interest - python

Can anyone guide me on how to get a list of POI from a particular Location?
I have a list of Latitude and Longitude, I want to retrieve the list of POI around every location using python.
I am a beginner so I don't really know from where to start

Related

Find and Delete out of range data from dataframe

I am working with Latitude and Longitude dataset (pandas dataframe). I tried to find minimum and maximum values of latitude and longitude to get a bounding box and export the image of the area from Open Street Map. The results is showing out of range data and I want to find and remove all of out of range data from my dataset. Not sure what is the best way of doing this.
Thanks for any help.
I think you can use np.where. For e.g. you want to filter out longitude & latitude of certain range, you can use this in way
np.where((df['longitude']>=100) & (df['latitude']<=100) | (df['longitude']<=100) & (df['latitude']>=100) )
Ofcourse you need to modify range/column name & equality logic based on the requirement.
More information will certainly help in answer question better.

finding nearest edge to a gps point by querying OpenStreetMap in Athena

Previously I have used OSMnx library in python to get the closest drive way to a particular gps datapoint. To do so I was using following code:
places=['Nebraska, USA']
G=ox.graph_from_place(places,network_type='drive')
origin_point = (lat, long)
nearest_edge = ox.get_nearest_edge(G, origin_point)
Now what I want to do is querying OpenStreetMap with Athena for the same thing (still in the python). I want to give bunch of gps datapoints and for each datapoint get the closest road. Does anyone know how I should do this?
Also if you know any documentation which can help I really appreciate it.
Thanks
Athena and Presto support Geo-spatial functions such as:
SELECT ST_Distance(ST_Point(-71.0882, 42.3607), ST_Point(-74.1197, 40.6976))
Based on the dataset that you want to focus on and its format you can build in S3 a databased on the location that you care about such as roads in Nebraska, USA, and query against it.

How to find if a GPS coordinate lies on a specific road

Is there a way to get all road of an area, and then find out if a GPS coordinate is on a specific road. Something like:
all_driveable_road_in_NY = [id1, id2, id3, ..., idn] //Where idi represents the road number i
gps_coordj = [lat1, lat2]
for p in range(0, len(all_driveable_road_in_NY):
if gps_coordj on road all_driveable_road_in_NY[p]:
print("gps on road : " + all_driveable_road_in_NY[p])
How could man do that in python using openstreetmap?
Any hints will be welcome.
Thanks
A linear search by road name is not appropriate for this problem. For example, we don't need to search all roads in the Bronx to find a location in Manhattan. Instead swap the search criteria.
Suppose we have a large database of (road, lat long) corresponding to a point on each road every x meters. We have many data points for each road. Rather than searching all existing roads, we can search for the closest location. Any database can index these points for faster searches, probably using some sort of tree under the hood for O(log(n)) searches rather than O(n).
It's the same technique you would use when searching a word in a dictionary (like the book. okay maybe you would just use google, but hear me out). To find 'hello', you would first open the book halfway and see you are at 'R'. Now you know you only need to search the front half of the book, not the entire book. In the same way, we order the lat, long points to help us search faster.
Unless you are running this database, it will need to be supported by your API. This sounds like a common use case, so it's likely that it is supported.

Cross Referencing list of addresses to custom google maps

I would like to find for every address in my list, what is the constituency that the address belongs to.
I have found this map, that lists the constituency by location
https://www.google.com/maps/d/viewer?mid=12vZFyd7VqJyI2v5XOhBK5olnPnw&ll=1.343725467746546%2C103.87371266459195&z=12
My addresses are of the form
Marine Parade Central
Marine Vista
etc. I can geocode them to obtain latitude longitude as well.
Manually, you can key this address into the map, then find out which constituency it belongs to. Is there a way to automate this process? I've only used the heatmap layer before, and downloading the map is only available in KML. If only there was a simple API for this.. If there was a python way to go about this, would be preferable, but anything that works really.
Would be really grateful if someone can guide me on this! :)

Dictionary using 2 keys with easy to find maximum value?

I'm fairly new to python and I need advice on figuring out how to implement this. I'm not sure what the best structure to use would be.
I need a dictionary type structure that has 2 keys for a value. I need retrieve the value with both keys, but delete the value by either key. I also need to be able to find the maximum value and return the key (or a list of keys if there are duplicate maximums)
Basically this is for finding the longest distance between any 2 points on a graph. I will have a list of points and I can calculate all the distances, but at any time I need to get the maximum distance and which points it connects. Any point can be removed at any time so I need to be able to remove values that connect to those points.
Obviously there is no existing structure that does this so i'll have to write my own class but does anyone have advise where to start? At first I was going to use a dictionary with a tuple key, but is there a fast way to find the maximum value and also get the key (or list of keys - with the possibility of duplicate values). Also how can I easily delete values by a single part of the tuple?
I'm not asking for anyone to solve this for me, I'm trying to learn, but any advice would help. Thanks in advance.

Categories

Resources