Can you export latitude and longitude with +- information to csv file?

Started by brinkster, September 20, 2016, 08:53:29 PM

Previous topic - Next topic

brinkster

I'm trying to export gps data from approx. 60,000 images to a csv file.  I need the lat/long coordinates to be combined with a reference of +/- so I can use the data in a gis program.  Here is the command I am using.

exiftool -csv -filename -DateTimeOriginal -gps:GPSLatitude -gpslatituderef -gps:GPSLongitude -gpslongituderef -n -r G:\DCIM > C:\Users\TIM\Desktop\image_gps_data\ba396.csv

This is separating the reference from the lat/long and it's giving me N/W as opposed to +/-.  Is there a tag that will convert the cardinal directions and combine them with the lat/long on the output?

StarGeek

Don't specify GPS group tags, just use the tag name by itself.  That will default to the composite tags which will have the proper reference.

exiftool -csv -filename -DateTimeOriginal -GPSLatitude -gpslatituderef -GPSLongitude -gpslongituderef -n -r G:\DCIM > C:\Users\TIM\Desktop\image_gps_data\ba396.csv
* Did you read FAQ #3 and use the command listed there?
* Please use the Code button for exiftool code/output.
 
* Please include your OS, Exiftool version, and type of file you're processing (MP4, JPG, etc).

brinkster

Thank you StarGeek, that worked.  Do I need to mark this topic as resloved and how do I do that?

brinkster

I have one more question about exporting to csv.  When the date/time stamp is exported it shows up in the original format from the exif data but I need it to be in a different format.  Is there a way to change the format when exporting? 

eg. 2016:08:13 08:41:20 to 2016/08/13 08:41:20

StarGeek

Use the -d option.  You can find the date codes here.

You would want to use something like this (but verify, I'm going from memory here):
-d "%Y/%m/%d %H:%M:%S%"
* Did you read FAQ #3 and use the command listed there?
* Please use the Code button for exiftool code/output.
 
* Please include your OS, Exiftool version, and type of file you're processing (MP4, JPG, etc).

StarGeek

* Did you read FAQ #3 and use the command listed there?
* Please use the Code button for exiftool code/output.
 
* Please include your OS, Exiftool version, and type of file you're processing (MP4, JPG, etc).

brinkster

That didn't seem to work.  Does it matter where in the command you place it?  Here is what I have.

exiftool -csv -filename -DateTimeOriginal -d "%Y/%m/%d %H:%M:%S%" -GPSLatitude -GPSLongitude -n -r G:\DCIM > :\Users\TIM\Desktop\image_gps_data\ba396.csv

Also since this tool is turning out to be more powerful than I thought I was wondering if I could take the GPS time and GPS date from the exif data and combine them instead of using DateTimeOriginal.  It would make my data more accurate as some directories contain images from different timezones.  They appear as such in the exif data.

GPSTimeStamp - 13  41  21.0
GPSDateStamp - 2016:08:13


I need them in the format of      2016/08/13 13:41:21

Thank you for all your help. 

StarGeek

Quote from: brinkster on September 21, 2016, 06:16:35 PM
That didn't seem to work.  Does it matter where in the command you place it?  Here is what I have.

exiftool -csv -filename -DateTimeOriginal -d "%Y/%m/%d %H:%M:%S%" -GPSLatitude -GPSLongitude -n -r G:\DCIM > :\Users\TIM\Desktop\image_gps_data\ba396.csv

Sorry, typo.  Remove the trailing percent sign.  -d "%Y/%m/%d %H:%M:%S".  The position in the command is fine.

QuoteAlso since this tool is turning out to be more powerful than I thought I was wondering if I could take the GPS time and GPS date from the exif data and combine them instead of using DateTimeOriginal. 

Try using GPSDateTime.  Another composite tage which combines the two.  The -d option will affect this as well.

* Did you read FAQ #3 and use the command listed there?
* Please use the Code button for exiftool code/output.
 
* Please include your OS, Exiftool version, and type of file you're processing (MP4, JPG, etc).

brinkster

The GPSDateTime worked however it's still putting it out in this format. 

2016:08:13 13:41:21Z


I also need to remove the 'Z' as that will create issues with the program I'm trying to process the data in. 

StarGeek

Ah, yes. Sorry.  The -n option is overriding the -d.  You can remove the -n, which will affect all tags, and specifically target the Lat/Long tags with a # at the end of the tag, like this:

exiftool -csv -filename -GPSDateTime -d "%Y/%m/%d %H:%M:%S" -GPSLatitude# -GPSLongitude# -r G:\DCIM > :\Users\TIM\Desktop\image_gps_data\ba396.csv
* Did you read FAQ #3 and use the command listed there?
* Please use the Code button for exiftool code/output.
 
* Please include your OS, Exiftool version, and type of file you're processing (MP4, JPG, etc).

brinkster

Perfect,  that works.  Thank you very much for your patience.  I think that's all for now. 

SS-Cyber-Sec

Quote from: StarGeek on September 20, 2016, 09:19:56 PM
Don't specify GPS group tags, just use the tag name by itself.  That will default to the composite tags which will have the proper reference.

exiftool -csv -filename -DateTimeOriginal -GPSLatitude -gpslatituderef -GPSLongitude -gpslongituderef -n -r G:\DCIM > C:\Users\TIM\Desktop\image_gps_data\ba396.csv

I am trying to export gps output of a videofile from  a dashcam to a csv file, and I have tried the following comand, but only get a 1 line output in my csv file, whereas exiftool generates GPS coordintes 4 times every second, is there a way to do this?

exiftool -csv -gpslatitude -gpslongitude -gpsspeed -gpsspeedref -gpsdatetime -ee [filename.mp4] > output.csv

filename.mp4 is the name of the video that lasts for 1 minute, so I should get 240 lines for a minute

Phil Harvey

The -csv option can't be used like this.  Instead, you must use -p.

See this post.

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

SS-Cyber-Sec

I replaced the -csv with -p and still did not get any output

This is the command I used

exiftool -p -gpslatitude -gpslongitude -gpsspeed -gpsspeedref -gpsdatetime -ee [Dir ...] > output.csv

Also used this and did not get a proper output

exiftool -n -p "$gpslatitude,$gpslongitude,$gpsdatetime,$gpsspeed" FILE :-\

StarGeek

The first command won't work because you need a format string for the -p (-printFormat) option, not individual tags.

In the second command, you have the -p format string, but you forgot the -ee (-extractEmbedded) option.
* Did you read FAQ #3 and use the command listed there?
* Please use the Code button for exiftool code/output.
 
* Please include your OS, Exiftool version, and type of file you're processing (MP4, JPG, etc).