Composite tag to convert GPS coordinates to Grid Square Locator (config file)

Started by CWCorrea, March 11, 2024, 08:54:38 PM

Previous topic - Next topic

CWCorrea

Hello.

The attached config file (locator.config) defines the Composite tag Locator that converts or geocodes GPS coordinates to a Grid Square or Maidenhead Locator, mainly used by amateur radio operators. For example, the coordinates 38.861903, -77.116753 are converted to the grid square locator FM18ku.

The precision (or the size) of the grid square locator is defined by the UserParam LocatorPrecision, which defaults to 6 characters. Valid values for LocatorPrecision are 2, 4, 6, 8, and 10 characters. The higher the number, the smaller and more precise the Grid Square.

exiftool -config locator.config -gpslatitude -gpslongitude -locator -userparam locatorprecision=8 image.jpg

GPS Latitude                    : +38.861903
GPS Longitude                   : -77.116753
Locator                         : FM18ku56

exiftool -config locator.config -gpslatitude -gpslongitude -locator image.jpg

GPS Latitude                    : +38.861903
GPS Longitude                   : -77.116753
Locator                         : FM18ku

To see the grid square locator in a map go to https://dxcluster.ha8tks.hu/hamgeocoding/ and enter the Locator in the "Grid Square" field.

Here you can see the FM18ku grid square locator in a map:



Let's say you are an amateur radio operator and want to move all the pictures with valid GPS coordinates in dir into folders based on the grid square Locator, you could use the command

exiftool -config locator.config '-Directory<Locator' dir

This command would move the file dir/image.jpg with GPS coordinates +38.861903, -77.116753 to FM18ku/image.jpg

This config file has been tested with ExifTool 12.78 on macOS and Linux.

Christian W. (HK4QWC)
Grid Square Locator: FJ26ee

Phil Harvey

...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 ($).