Column for JPG geolocation

Please check the FAQ (https://www.xyplorer.com/faq.php) before posting a question...
Post Reply
tonifelfe
Posts: 38
Joined: 17 Jun 2009 14:03

Column for JPG geolocation

Post by tonifelfe »

Is there an easy way to have such a column or 2?

highend
Posts: 13327
Joined: 06 Feb 2011 00:33
Location: Win Server 2022 @100%

Re: Column for JPG geolocation

Post by highend »

Easy? Depends...

Use a custom column script that reads out the exif values, formats them (if necessary) and returns them.

E.g.:

Code: Select all

Snip: CustomColumn 1
  XYplorer 18.60.0103, 16.01.2018 00:55:58
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
One of my scripts helped you out? Please donate via Paypal

tonifelfe
Posts: 38
Joined: 17 Jun 2009 14:03

Re: Column for JPG geolocation

Post by tonifelfe »

Thanks for that fast overnight response - it works fine! :beer: :beer: :beer:

Post Reply