Feature Request: Geolocation using alternate Postal Code DB

Started by ThankYou, November 18, 2024, 03:35:30 AM

Previous topic - Next topic

ThankYou

Is it possible to build the geolocation database using the Postal Code dataset from GeoNames?

I have been using the geolocation feature of exiftool which is awesome. The issue I've encountered is inconsitencies in the source data from the full GeoNames dataset. I noticed that geonames also provides a Postal Code database which is a simpler but more consistent, and I think some users including myself may prefer that to the larger dataset.

https://download.geonames.org/export/zip/

StarGeek

Phil is currently away for a couple of weeks, so there will be some time before you get a response on this.

See this post for instructions on how to get an email notification when there's an update.
"It didn't work" isn't helpful. What was the exact command used and the output.
Read FAQ #3 and use that cmd
Please use the Code button for exiftool output

Please include your OS/Exiftool version/filetype

FrankB

Maybe this gives you an idea for an alternative. You can query https://Geocode.maps.co for postal codes. For the Netherlands it works. You will need to get a free Api_key!

https://geocode.maps.co/search?q=5421%20cc&api_key=Your_Api_Key
 
place_id    339196343
licence    "Data © OpenStreetMap contributors, ODbL 1.0. https://osm.org/copyright"
boundingbox   
0    "51.394593186486"
1    "51.714593186486"
2    "5.5298097189189"
3    "5.8498097189189"
lat    "51.554593186486485"
lon    "5.6898097189189185"
display_name    "Gemert, Gemert-Bakel, North Brabant, Netherlands, 5421 CC, Netherlands"
class    "place"
type    "postcode"
importance    0.325

You can test this also with ExifToolGui.
Gui_1.jpg
Gui_2.jpg

Frank

stoffball

Quote from: ThankYou on November 18, 2024, 03:35:30 AMI noticed that geonames also provides a Postal Code database which is a simpler but more consistent,

This is not generally valid. For Germany the postal code database contains e.g. also many companies which have an own postal code. And for bigger cities which have several postal codes there are several entries for the different sub-regions of the cities. So this postal code database is not per se simpler.

Also exiftool is using the feature code and the population number to find the next match. Both of these search criteria are missing in the postal code database. So this would require more changes to the code.

ThankYou

Thank you everyone for the comments. @FrankB, I think your suggestion seems like it would be exactly what I'm looking for, but is that something that can be called via the exiftool terminal command?

My use case is that I am reorganizing a large library of photos and images. I'm using exiftool to create an XMP sidecar for every image with the various meta data refactoring rules I've developed to suit my needs.

Ideally, I would like to include the city, county, state/province, and country metadata in the XMP file.

The challenge I've found with the geonames Gazetteer dataset (the one exiftool uses) is that population data is missing for a lot of cities so using the population filter on a larage diverse set of images has incosistent results, and it has nothing to do with exiftool directly.

I've tried to remedy this first by tweaking my exiftool geolocation settings to craft the output, and then by tweaking the build_geolocation settings to craft the dataset. My ultimate conclusion is that geonames dataset is just too inconsistent for my use case.

GeoNames provides a second Postal Codes dataset that lacks the population data, and is limited to cities and postal codes, and in my cursory review is much more consistent than the Gazetteer dataset. I've considered taking the Postal Code dataset, and then manually adapting it to the GeoNames Gazetteer dataset format, and then running the exiftool build_geolocation tool as-is to produce a postal code dataset that works with exiftool. The issue I perceive with this approach is that the geolocation function will return the postal code center nearest the images' GPS coordinates which may not be the actual postal code the image is located in. That's a compromise I'm willing to live with, but correctly representing the city location of the image is preferred.

I'm an exiftool newbie in the sense this is my first exiftool project, but I have tried to read as much of the resources as possible. Looking for feedback from the experts here.

Thanks in advance for all the help.

FrankB

Quote from: ThankYou on Today at 01:26:42 AM@FrankB, I think your suggestion seems like it would be exactly what I'm looking for, but is that something that can be called via the exiftool terminal command?

No. GUI uses the GeoCode webservice to get the data (lat, lon, country, city etc) and ExifTool to update the files.

ThankYou

Quote from: FrankB on Today at 01:56:47 AM
Quote from: ThankYou on Today at 01:26:42 AM@FrankB, I think your suggestion seems like it would be exactly what I'm looking for, but is that something that can be called via the exiftool terminal command?

No. GUI uses the GeoCode webservice to get the data (lat, lon, country, city etc) and ExifTool to update the files.

Ahhh, I didn't even know ExifToolGUI existed though so thanks for sharing. It looks like it will come in handy if not for this dilema.