CC snippet - EXIF GPS coordinates

Discuss and share scripts and script files...
Post Reply
highend
Posts: 13274
Joined: 06 Feb 2011 00:33

CC snippet - EXIF GPS coordinates

Post by highend »

How to set up a custom column with a snippet: viewtopic.php?f=7&t=18653

This one displays the EXIF GPS coordinates of all .jpg and .tiff files in a folder in a custom column.

It does not require external tools like exiv2 (http://www.exiv2.org/index.html)

The snippet code:

Code: Select all

Snip: CustomColumn 1
  XYplorer 18.90.0000, 22.03.2018 12:08:22
Action
  ConfigureColumn
Caption
  GPS Location
Type
  3
Definition
      $latitude  = get("exif", 0x0002, <cc_item>); // 52/1 13/1 85053/2500  -> 52 deg 13' 34.02" N
      $longitude = get("exif", 0x0004, <cc_item>); // 13/1 13/1 134931/2500 -> 13 deg 13' 53.97" E
  
      if ($latitude && $longitude) {
          $latitudeRef  = get("exif", 0x0001, <cc_item>);
          $longitudeRef = get("exif", 0x0003, <cc_item>);
  
          $latDegree    = gettoken(gettoken($latitude, 1), 1, "/");
          $latMinutes   = gettoken(gettoken($latitude, 2), 1, "/");
          $latSeconds   = replace(round(eval(gettoken($latitude, 3)), 2), ",", ".");
  
          $longDegree   = gettoken(gettoken($longitude, 1), 1, "/");
          $longMinutes  = gettoken(gettoken($longitude, 2), 1, "/");
          $longSeconds  = replace(round(eval(gettoken($longitude, 3)), 2), ",", ".");
          return $latDegree . " deg " . $latMinutes . "' " . $latSeconds . '" ' . $latitudeRef . " | ". $longDegree . " deg " . $longMinutes . "' " . $longSeconds . '" ' . $longitudeRef;
      } else { return "<no gps coordinates>"; }
Format
  1
Trigger
  0
Item Type
  0
Item Filter
  jpg;tiff

It looks like this:
cc_setup.png
cc_setup.png (12.65 KiB) Viewed 3122 times
One of my scripts helped you out? Please donate via Paypal

Alan_CLarke59
Posts: 1
Joined: 15 Mar 2019 15:29

Re: CC snippet - EXIF GPS coordinates

Post by Alan_CLarke59 »

Hi All,
This function is exactly what I need, however, I can't get it to work.
I am following the instructions correctly I believe, but no success.

This is the exif data from my picture:
Image

Can anyone help please?


Regards,

Alan C

highend
Posts: 13274
Joined: 06 Feb 2011 00:33

Re: CC snippet - EXIF GPS coordinates

Post by highend »

There is no image...
One of my scripts helped you out? Please donate via Paypal

admin
Site Admin
Posts: 60357
Joined: 22 May 2004 16:48
Location: Win8.1 @100%, Win10 @100%
Contact:

Re: CC snippet - EXIF GPS coordinates

Post by admin »

Strange, but you can right-click the word "Image" to show the image... :?

highend
Posts: 13274
Joined: 06 Feb 2011 00:33

Re: CC snippet - EXIF GPS coordinates

Post by highend »

Mh, not here. Regardless of any exif data, what exactly does the custom column show? Provide a picture^^
One of my scripts helped you out? Please donate via Paypal

Post Reply