Idea came to life during geolocation of a picture taken in unknown location. I thought it would be very helpful to ask google maps to find "all restaurants in area with maximum distance of 30 metres from newspaper kiosk". So I've written simple python script that allows querying Google Maps API for 2 specific places within precise distance from each other in given area.
Latitude and Logtitude - points to the center of the search circle. For best results give closest approximate coordinates to place you are trying to find.
Radius - Defines radius for area to search from given above coordinates. The maximum allowed radius is 50 000 meters. Because of Google Maps advertising policy, sometimes one or two places can be included from outside of the given radius.
Keyword - A term to be matched against all content that Google has indexed for this place, including but not limited to name, type, and address, as well as customer reviews and other third-party content.
Category - Restricts the results to places matching the specified type. Only one type may be specified (if more than one type is provided, all types following the first entry are ignored). See the list of allowed categories .
Distance - Number (in metres) defines distance beetwen to searched places (landmarks).
Min. required python version: 3.6 HOW TO RUN IT?
Copy all files (including 'assets' folder) to your disk. Remeber to paste your API Google Map key into 'assets/auth_key.py' file.
Run script with command: python geolocatethis.py
While searching program prints out coordinates of places that met previously given criteria.
Let's assume we need to geolocate this photo: USE EXAMPLE:
All we know it was taken somewhere in southern Berlin near Schonefeld. On the photo, there is a pharmacy and a small shop with Deutsche Post sing above the door. That is enough information to run program.
There are 4 parts of the city where photo potentially could have been taken: Rudow, Adlershof, Altglienicke, and Bohnsdorf. The best place to place marker for center point would be somewhere around State Park (52.415430, 13.526943).
Next, we should type in following data:
- Radius = 8000m (distance between the center point and edge of every adjacent neighborhood).
- A keyword for place 1 = 'pharmacy' (best to use a word in English as this is the main language of Google Maps database)
- Category for place 1 = 'pharmacy' (limit search only to actual pharmacies)
- A keyword for place 2 = 'post' (you can type in multiple keywords, however, in this case, is better to give a more general description as we don't know how this shop is described in google maps).
- Category for place 2 = 'store' (it will limit search only to stores with 'post' related keyword)
- Distance = 10m (rough estimate from photo)
...and yes, our pharmacy is in results ;)