Hello,
I recently took some photos on vacation. They are geotagged, and I can retrieve the coordinates from the image file easily with exiftool
.
I thought it would be a fun project to try to use OSM data to give the photos a better name… Rather than "IMG_20240929133700.jpg"
I’m hoping for something like "Germany/Cologne/Cologne Cathedral_20240929133700.jpg"
, or the equivalent in the local language, "Deutschland/Köln/Kölner Dom_20240929133700.jpg"
if the translation is too difficult.
My initial attempt was using nominatim
which was fun but not really a complete solution. For example, when I query for 50.94060085,6.95623888
I get a result of "7, Wallrafplatz, Andreasviertel, Altstadt-Nord, Innenstadt, Köln, Nordrhein-Westfalen, 50667, Deutschland"
. This is technically correct for those coordinates, but of course the coordinates are slightly off from reality – the photo was actually of the nearby Cathedral. However, I noticed that the JSON data included an interesting field "importance":0.21912463163390336
, which gives a rough estimate of how likely it is that this is the place someone is actually searching for. So I searched for a way to incorporate “importance” into my nominatim search and could not find a way.
My next attempt was with overpass
, where I discovered that I could query nearby objects with something like nwr[importance](around:300, 50.94060085,6.95623888)
. I think this is close to what I seek – the way
for Kölner Dom is within 300 meters of my coordinates and has the tag"importance": "international"
. It’s not clear to me why this one has a descriptive word where nominatim has a numerical value… The number would be much easier to rank. But more importantly, it seems to be just luck that Kölner Dom has this tag at all – no other object within the radius has an “importance” tag. When I attempt a similar strategy with coordinates from the nearby Rheinpark – 50.9492556,6.9727594
– I find no objects with the “importance” tag at all.
I’ve been using the overpy
python package to do these queries, if it makes a difference.
Is there a way to access a numerical “importance” tag with Overpass, like I get with nominatim?
Ideally, I’d like to return only the most important object within my search radius, or perhaps a ranked set of the top five, or something similar.
Thanks for your help, and thanks for making this data publicly available in the first place!