Open Street Map data mining project.
Open Street Map Locator (OSML) was designed to find the coordinates of where a picture or video was taken by analyzing the surroundings. For example, if there are a CVS, McDonald's, and Walmart in close proximity, OSML can narrow down the possible locations to just a few.
-
Make sure you have python >=3.7 installed
-
Download the files in this repository
-
Pip install these 3 libraries in cmd prompt
pip install requests
pip install xmltodict
pip install folium
Example Scenario:
Ok lets say someone were to post this photo on social media. We can easily make out a mcdonalds, starbucks, and popeyes close together.
Step 1. Get approximate distance
These 3 stores are no more than .2 kilometers apart from eachother
Step 2. Initial guess
We need two coordinates of a rectangle that we want the program to search in. If you already have a general idea of where the location is you can use that. If you do not you can use the entire world or an entire country.
I Know my location is somewhere in Texas I need the South-West corner and the North-East corner's lat and lon
SW: 26.292681, -106.582503
NE: 36.508981, -93.003398
Step 3. Finding descriptors
For this step, go to openstreetmap.org
in the search bar, type in popeyes. Find any popeyes and click on it. This will bring up a table of information labled Tags
Choose a few tags that may be relevant to popeyes, some strong ones include:
- brand
- brand:wikidata
- name
(if you are trying to locate based on other features like a water tower or a bridge, choose the tags relevant to that feature)
The left column will be your key
and the right column will be your value
, you will need to remember this for later
repeat this step for the three locations (mcd, popeyes, starbucks)
here are my descriptors:
McDonalds - brand:wikidata = Q38076
Starbucks - brand:wikidata = Q37158
Popeyes - brand:wikidata = Q1330910
Step 4. Run main.py Run the python script and follow the instructions
Step 5. interpret output If you see green and results found, that means it found potential locations.
You can open map.html by double clicking the file and view the locations on a map
If you see no results found, that may mean these locations mcdonalds, popeyes, and starbucks, are missing on openstreetmap or you may need to increase your distance threshold.
Step 6. Reading Map The results are saved to a file named confirmed.json. the files named coords<#>.txt are the coordinates found for individual locations (Mcd, popeyes, starbucks)
Open map.html
The area highlighted in green is the area that the code searched in.
Now look through all the points to see if the mcdonalds, wendys, and starbucks are positioned correctly
Tips:
-
look at how the the roads and buildings are aligned
-
if you find a potential location, click the pin icon in your upper left corner, drop a pin on the location, and click on the pin. This will show the coordinates and you can put that into google maps street view.
-
to mark already inspected locations, use a pin
MIT