Author Topic: gpsposition format  (Read 2497 times)

fager

  • Newbie
  • *
  • Posts: 4
gpsposition format
« on: January 03, 2015, 09:12:42 AM »
Hi,

I would like to write the GPS information, stored in EXIF information of multiple JPG files to the XMP description field. Afterwards I will use the XMP description information in Adobe Indesign as image caption.

Using this forum and the FAQ's I managed to find this command line:
exiftool "-xmp:description<$gpsposition" *.jpg

This results in an XMP description like:
35 39 14.46480000 N, 139 45 27.50040000 E
I expacted the result to like the command line output: 35 deg 39' 14.46" N, 139 deg 45' 27.50" E

After some reading here I tried:
exiftool -n "-xmp:description<$gpsposition" *.jpg
That result in an XMP description like:
35.654018 139.757639
I'm missing N/S resp. E/W.

Is there any chance to get the gpsposition format look either
35 deg 39' 14.46" N, 139 deg 45' 27.50" E
or
35.654018 N 139.757639 E
?

Thanks in advance for your support!

Phil Harvey

  • ExifTool Author
  • Administrator
  • ExifTool Freak
  • *****
  • Posts: 16724
    • ExifTool Home Page
Re: gpsposition format
« Reply #1 on: January 03, 2015, 12:29:25 PM »
The -c option gives you full control over the coordinate formatting.  Here is the relevant section of the application documentation:

       -c FMT (-coordFormat)
            Set the print format for GPS coordinates.  FMT uses the same syn-
            tax as the "printf" format string.  The specifiers correspond to
            degrees, minutes and seconds in that order, but minutes and sec-
            onds are optional.  For example, the following table gives the
            output for the same coordinate using various formats:

                        FMT                  Output
                -------------------    ------------------
                "%d deg %d' %.2f"\"    54 deg 59' 22.80"  (default for reading)
                "%d %d %.8f"           54 59 22.80000000  (default for copying)
                "%d deg %.4f min"      54 deg 59.3800 min
                "%.6f degrees"         54.989667 degrees

            Notes:

            1) To avoid loss of precision, the default coordinate format is
            different when copying tags using the -tagsFromFile option.

            2) If the hemisphere is known, a reference direction (N, S, E or
            W) is appended to each printed coordinate, but adding a "+" to the
            format specifier (eg. "%+.6f") prints a signed coordinate instead.

            3) This print formatting may be disabled with the -n option to
            extract coordinates as signed decimal degrees.


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

fager

  • Newbie
  • *
  • Posts: 4
Re: gpsposition format
« Reply #2 on: January 03, 2015, 03:02:33 PM »
Hi Phil,

many thanks for your quick replay.

The -c option does the trick; must have missed it scanning the documentation.

Any chance getting a ° into the description?
I tried using HTML Code, without avail:

exiftool "-xmp:description<$gpsposition" -E *.jpg -c "%d&deg;%d'%.2f"\"

Phil Harvey

  • ExifTool Author
  • Administrator
  • ExifTool Freak
  • *****
  • Posts: 16724
    • ExifTool Home Page
Re: gpsposition format
« Reply #3 on: January 03, 2015, 06:58:52 PM »
You should be able to just put whatever character you want direcctly into the -c format string.

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

fager

  • Newbie
  • *
  • Posts: 4
Re: gpsposition format
« Reply #4 on: January 04, 2015, 07:06:01 AM »
Hi Phil,

I was using this command
exiftool "-xmp:description<$gpsposition" -E *.jpg -c "%d°%d'%.2f"\"

And I got:
35?39'14.46" N, 139?45'27.50" E

The ° seems to be a special character.

Phil Harvey

  • ExifTool Author
  • Administrator
  • ExifTool Freak
  • *****
  • Posts: 16724
    • ExifTool Home Page
Re: gpsposition format
« Reply #5 on: January 04, 2015, 08:56:14 AM »
Right. So you must use the -charset option to specify the encoding you are using (this defaults to UTF-8 if not specified).  If you are on Windows, it is likely that adding -L will do the trick.

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

fager

  • Newbie
  • *
  • Posts: 4
Re: gpsposition format
« Reply #6 on: January 04, 2015, 11:49:11 AM »
Hi Phil,

thanks again.
The following works as desired:
exiftool "-xmp:description<$gpsposition" -L *.jpg -c "%d°%d'%.2f"\"

 :)