Geolocation alternate databases

Started by wywh, June 13, 2024, 02:01:19 PM

Previous topic - Next topic

wywh

I experimented with alternate Geolocation.dat files and got them working by adding this line to example.config file:

$Image::ExifTool::Geolocation::geoDir = '/Users/matti/Desktop/a';
A minor trouble was how to set build_geolocation to use cities500.txt as an input (macOS 14.5). This fails:

ls
admin1CodesASCII.txt alternateNamesV2.txt cities500.txt example.config
admin2Codes.txt build_geolocation countryInfo.txt featureCodes_en.txt

./build_geolocation -p 50 cities500.txt .
Error opening database ./allCountries.txt

After renaming cities500.txt as allCountries.txt it works:

./build_geolocation -p 50 .
Reading ./allCountries.txt... Done.
Reading ./featureCodes_en.txt
Reading ./countryInfo.txt
Reading ./admin1CodesASCII.txt
Reading ./admin2Codes.txt
Reading ./alternateNamesV2.txt... Done.
Processing database entries... Done.
Writing ./Geolocation_out/Geolocation.dat (version 1.03) and AltNames.dat...
Writing 18 language files to ./Geolocation_out/GeoLang...
Output file size(s):
    4.92 MB Geolocation.dat (183245 entries)
    4.84 MB AltNames.dat
    4.90 MB GeoLang/*.pm
   14.67 MB Total

I was surprised that even <500 places are included in that database:

exiftool -config example.config -a -api Geolocation='Velkua'
Geolocation City                : Velkua
Geolocation Region              : Southwest Finland
Geolocation Subregion           : Turku
Geolocation Country Code        : FI
Geolocation Country             : Finland
Geolocation Time Zone           : Europe/Helsinki
Geolocation Feature Code        : PPLA3
Geolocation Feature Type        : Seat Of A Third-order Administrative Division
Geolocation Population          : 220
Geolocation Position            : 60.4667, 21.6668

- Matti

Phil Harvey

Hi Matti,

Quote from: wywh on June 13, 2024, 02:01:19 PMA minor trouble was how to set build_geolocation to use cities500.txt as an input (macOS 14.5).

Try downloading the current version of build_geolocation.  This should work.  I just tested it here and it works for me.

QuoteI was surprised that even <500 places are included in that database:

Add the -v option to see why this is happening:

> build_geolocation -p 50 cities500.txt -l '' -v
Languages to read from input database(s):
  <none>
Parameters for reading cities500.txt:
  Minimum populations (??=any country):
    ??=50
  Features to keep regardless of population:
    ??=PPLA,PPLA2
  Features to keep for population >= minimum:
    ??=PPL,PPLA,PPLA2,PPLA3,PPLA4,PPLA5,PPLC,PPLCH,PPLF,PPLG,PPLH,PPLL,PPLQ,PPLR,PPLS,PPLW,PPLX,STLMT
(I usually add -l '' to the command only to speed things up for testing purposes.)

Oh, right.  You meant in the input cities500.txt from geonames.org.  They use the same logic to ignore population for some admistrative features.  Check their readme.txt file.

- Phil
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux/PowerShell, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

wywh

Doh, just deleting . from the end fixed that:

./build_geolocation -p 50 cities500.txt
- Matti

Phil Harvey

Quote from: wywh on June 13, 2024, 02:31:03 PMDoh, just deleting . from the end fixed that:

Yeah.  Doh.  I didn't notice that.  Yes, the command will read multiple databases if there are multiple file/directory names on the command line.

- Phil
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux/PowerShell, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).