Latitude and Longitude

Please check the FAQ (https://www.xyplorer.com/faq.php) before posting a question...
Cape_Ann
Posts: 3
Joined: 13 Jun 2015 00:40

Latitude and Longitude

Post by Cape_Ann »

I have a digital camera with GPS that makes the latitude and longitude properties of the picture file. I want to be able to list the latitude and longitude in the folder directory and then be able to export the directory to either a CSV or Excel file. Can anyone tell if this is possible and if so how to do each step. Thank you from Cape_Ann

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

Re: Latitude and Longitude

Post by highend »

Possible, but very slow...

The main problem: Somehow the properties "System.GPS.Latitude" & "System.GPS.Longitude" don't provide any values on my limited images with gps coordinates (which would make the whole process a hundred times faster)...

- Download Exiftool (http://www.sno.phy.queensu.ca/~phil/exi ... l-9.97.zip)
- Extract that .zip archive
- Rename exiftool(-k).exe to exiftool.exe
- Remember the path to it

XY side:
View - Colums - New Column
Right click the "New" column -> Configure Custom Columns...

Click on a free entry (e.g. the first with the name "(Undefined)"), click "Edit..."

Caption: GPS
Type: Script
Script content box:
Code:

Code: Select all

$exifTool = "D:\Tools\@Command Line Tools\exiftool\exiftool.exe";
    $positions = runret("""$exifTool"" -gpslatitude -gpslongitude ""<cc_item>""");
    $latitude = trim(gettoken(regexmatches($positions, "latitude.*\r?\n"), 2, ":"));
    $longitude = trim(gettoken(regexmatches($positions, "longitude.*\r?\n"), 2, ":"));
    if ($latitude && $longitude) { return replace($latitude . " | " . $longitude, "<crlf>"); }

Format: Text
Trigger: Browse
Item type: Files
You should use the filter as well. E.g.: jpg;tiff
Ofc you can enter additional extensions (separated by ;) as well (for all those formats that support exif params!)

Click "OK".

Regarding the script content box:
Replace the path to your exiftool.exe file with the one on your system

The entry should look like this now: GPS, Script (jpg;tiff)

Click "OK"

Now right click the "New" column again -> Select Custom Column...

Choose the newly created entry ("GPS"), click "OK".

Now whenever you want to export all rows, hit F12, choose the "Report" tab, then the "Current List" tab.
[x] Column headers
Subitem separator: Other = ,
Click on "To File..."

Done
One of my scripts helped you out? Please donate via Paypal

Cape_Ann
Posts: 3
Joined: 13 Jun 2015 00:40

Re: Latitude and Longitude

Post by Cape_Ann »

Whether

Thank you,

I not confidant that I am up to the task that you have suggested

I did look at downloading Exiftool then learned that is should make sure that I had PERL installed.

Then my constant fear is that I will do more harm than good when I have learned just enough to be dangerous.

I have Windows 7 Professional and have noted that it depends which program I view the file properties with as to whether the latitude and longitude can be copied to the clipboard.

I have been able to manually do what I hoped to with the right program.

It was in search of a means to complete this task that have downloaded XYplorer.

Thank you again.

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

Re: Latitude and Longitude

Post by highend »

From the website:
ExifTool is also available as a stand-alone Windows executable
There is no need for perl on a windows machine at all to be able to use the command line version of exiftool and the link I've posted downloads exactly this version...
One of my scripts helped you out? Please donate via Paypal

Cape_Ann
Posts: 3
Joined: 13 Jun 2015 00:40

Re: Latitude and Longitude

Post by Cape_Ann »

I have found a program that do what I want.
It is BR's EXIFextracter
If you search you will find it.

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

Re: Latitude and Longitude

Post by admin »

Next beta (v15.30.0002) will have something that might help: a new undocumented (because still experimental) value for get() that will return the RAW EXIF data identified by the TagID.

Code: Select all

get("exif", TagID, [file="<curitem>"])
For GPS related TagIDs see e.g.:
http://www.sno.phy.queensu.ca/~phil/exi ... s/GPS.html

Remember: And XY wants it in decimal, not hex.

And the return is RAW. These, for example, will both return the Exposure Time in a format that could look like "10/1250" meaning "1/125 Sec":

Code: Select all

echo get("exif", 33434); //dec

Code: Select all

echo get("exif", 0x829A); //hex

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

Re: Latitude and Longitude

Post by highend »

Nice but there is a problem...

Code: Select all

$file = "D:\Users\Highend\Bilder\_GPS EXIF.jpg";
  $lat = get("exif", 0x0002, $file);
  $latSec = format(eval(gettoken($lat, 3)), "0.00");
In ~70% of the cases it returns (which is valid):
52/1 13/1 85053/2500

But in ~30% it returns this instead:
8388609/1 1/100410288 24/0

Which leads to a /0 division xD

If you can't reproduce with a local image I send you the one I use...
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: Latitude and Longitude

Post by admin »

The function just returns the raw data. It's your problem what to do with them.

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

Re: Latitude and Longitude

Post by highend »

The function just returns the raw data.
It does but the return value is not always the same. That's the problem. And ofc the exif data hasn't changed once.
It's your problem what to do with them.
Sure
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: Latitude and Longitude

Post by admin »

OH, you mean it returns different results on the same call??? Yes, send me the image, this sounds interesting...

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

Re: Latitude and Longitude

Post by highend »

Mail mit Screenshot, gezippter Grafik, script und Beschreibung ist raus.
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: Latitude and Longitude

Post by admin »

Thanks and Sorry. Works perfectly here. Hm.

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

Re: Latitude and Longitude

Post by highend »

I can reproduce it with a fresh beta (latest) as well. It doesn't happen so often (about 1/15-20) but it happens...
One of my scripts helped you out? Please donate via Paypal

LittleBiG
Posts: 1846
Joined: 08 Apr 2011 12:57
Location: Win10x64

Re: Latitude and Longitude

Post by LittleBiG »

I can confirm, that what highend reported happens really frequently. There is no need a special picture, just locate a jpg which contains GPS info then run the command echo get("exif", 0x0002); repeatedly and you will see. Unfortunately it happens much more than 30% which makes the GPS handling in XY impossible. Isn't it possible that the problem is with an internal variable which somehow overflows?

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

Re: Latitude and Longitude

Post by admin »

But this is still true: viewtopic.php?p=125412#p125412

Post Reply