Insert GPS coordinates (lat/long/altitude) to batch of pictures using excel info

Started by kempo, May 12, 2014, 04:28:09 PM

Previous topic - Next topic

kempo

Hello,

I have found since couple of days the forum , I have read a lot of topics ( but it seems that not enough) but I cannot solve my issue.

Here are the information:

- on a folder I have a lot of pictures (300+);
- on an excel file I have for each picture the following columns : latitude, longitude, altitude (example attached); the excel file is in the same folder as the pictures.

It is possible to attach automatically on each of the picture from the folder the corresponding information from the excel file ?

If is possible, can you please guide me with the necessary steps?

Thank you.

Phil Harvey

Did you read this thread?

I think it describes exactly what you are trying to do.  Just export your excel file in CSV format, then follow the steps in the thread.

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

kempo

Quote from: Phil Harvey on May 13, 2014, 07:24:50 AM
Did you read this thread?

I think it describes exactly what you are trying to do.  Just export your excel file in CSV format, then follow the steps in the thread.

- Phil

Hi Phil,

I have just tried and here are the observations:

- as iLuna said, to have the right results I have added on the txt file, in front of each line "./" (ExifTool v 9.60) ;

- taking into consideration that I have for each picture the coordinates ( longitude, latitude, altitude) is possible to generate a KML file with small placemarks for each picture ?

Thank you for your help,
Alex

Phil Harvey

Hi Alex,

With ExifTool 9.60 the "./" should no longer be necessary.  Please tell me if you found it otherwise.

You can create a KML file from the images once they have been geotagged.  See this section of the geotagging page for details.

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

kempo

Quote from: Phil Harvey on May 14, 2014, 07:34:57 PM
Hi Alex,

With ExifTool 9.60 the "./" should no longer be necessary.  Please tell me if you found it otherwise.


I can confirm that, with 9.60, is necessary to have "./" in front of each line to work - please check the txt file attached on the previous post.

Quote from: Phil Harvey on May 14, 2014, 07:34:57 PM
You can create a KML file from the images once they have been geotagged.  See this section of the geotagging page for details.


Sorry Phil, but i'm lost....

I have all the pictures ( already gps tagged) in c:\images\tag , I must open a cmd.exe window and what next ?

Thank you,
Alex

Phil Harvey

Quote from: kempo on May 15, 2014, 02:26:43 PM
I can confirm that, with 9.60, is necessary to have "./" in front of each line to work - please check the txt file attached on the previous post.

Darn.  I'll see if I can duplicate this the next time I drag the Windows machine out of the closet.

QuoteI have all the pictures ( already gps tagged) in c:\images\tag , I must open a cmd.exe window and what next ?

1. Download and expand the full exiftool distribution and copy fmt_files/kml.fmt to c:\images\tag.  If you can't do that, then copy the kml.fmt file from the link I posted and paste it into a text file called c:\images\tag\kml.fmt.

2. open cmd.exe and type these two commands:

cd c:\images\tag

exiftool -p kml.fmt . > out.kml

There should now be a file called "out.kml" in c:\images\tag.  This is the KML file from your images.

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

Phil Harvey

Quote from: kempo on May 15, 2014, 02:26:43 PM
I can confirm that, with 9.60, is necessary to have "./" in front of each line to work - please check the txt file attached on the previous post.

I finally dragged out the Windows machine to test this.  I removed the "./" from the filenames in your file and all of these commands worked fine for me:

exiftool -csv=position_data.txt IMG_7220.JPG
exiftool -csv=position_data.txt ./IMG_7220.JPG
exiftool -csv=position_data.txt .

Where position_data.txt and IMG_7220.JPG where both in the current directory.

Could you please give me details about the command you used when this didn't work for you?

Thanks.

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

kempo

Hi Phis, sorry for the late response.

I have used these steps:

Quote from: Phil Harvey on May 05, 2014, 07:40:56 AM
Here are the steps:

1) Install ExifTool for command-line use.

2) Change the first line of your .txt file to this:

SourceFile,GPSLatitude,GPSLongitude,GPSAltitude,GPSRoll,GPSPitch,GPSTrack

3) Put the .txt file in C:\Users\m\Desktop\images with your images.

4) Open a cmd.exe window and type "cd c:\Users\m\Desktop\images" (without the quotes), then press RETURN.

5) Type this command, then press RETURN in the cmd window:

exiftool -csv=position_data.txt -gpslatituderef=N -gpslongituderef=W -gpsaltituderef=above -gpstrackref=T .

(don't forget the " .")

All done.

This will write everything but the Roll and Pitch, which aren't standard GPS tags.  To write non-standard GPS Roll and Pitch, install the sample config file from the full distribution.

- Phil

I can make a video capture screen if you want.

Also I have tried the KML "creation" and it is working :


The pictures are "grounded". It is possible to be at the altitude specified in the exif of each picture ? Something like here:



Thank you,
Alex


Phil Harvey

Hi Alex,

And did you confirm you are running the current version?  To do this, type "exiftool -ver" in your cmd.exe window.

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

kempo

Phil , I have made a small video :

https://www.youtube.com/watch?v=ll1lUqW1gyY

Phil Harvey

Hi Alex,

Thanks for this.  It looks like you were doing everything correctly.  Since I can't reproduce this problem, I will add some extra verbose output to ExifTool 9.62 which may allow me to debug the problem with your help.

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

kempo

Quote from: Phil Harvey on May 20, 2014, 02:20:09 PM
Hi Alex,

Thanks for this.  It looks like you were doing everything correctly.  Since I can't reproduce this problem, I will add some extra verbose output to ExifTool 9.62 which may allow me to debug the problem with your help.

- Phil

Phil, just let me know when v 9.62 is available and I will do some trials.

Phil Harvey

Hi Alex,

Great, thanks.  I'll post here when it is available.  Probably Saturday.

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

Phil Harvey

Hi Alex,

ExifTool 9.62 is now available.

With the -v2 option it will now list the full path for each SourceFile entry in the CSV database, and for each file without a corresponding SourceFile.  These full paths should match even if you don't have a "./" before the SourceFile name, but for some reason they don't on your system.  Please try this for one of the files where you get the "No SourceFile" error, and tell me what the -v2 output shows.

Thanks.

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

kempo

Quote from: Phil Harvey on May 24, 2014, 07:27:33 AM
Hi Alex,

ExifTool 9.62 is now available.

With the -v2 option it will now list the full path for each SourceFile entry in the CSV database, and for each file without a corresponding SourceFile.  These full paths should match even if you don't have a "./" before the SourceFile name, but for some reason they don't on your system.  Please try this for one of the files where you get the "No SourceFile" error, and tell me what the -v2 output shows.

Thanks.

- Phil

Hi Phil,

Using v 9.62 here is the message that I receive:



Maybe I'm doing something wrong but I don't know what...

Phil Harvey

Hi Alex,

Thanks, but that is only half the picture.  I need to know the full path as imported from the CSV file too (toward the top of the output).  I don't need to see them for all of the files, just both full paths for one image file.

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

kempo

Quote from: Phil Harvey on May 25, 2014, 03:23:25 PM
Hi Alex,

Thanks, but that is only half the picture.  I need to know the full path as imported from the CSV file too (toward the top of the output).  I don't need to see them for all of the files, just both full paths for one image file.

- Phil

Here is the info :


StarGeek

The path shown in the video is c:\gps\img.  The path in the screen shot is c:\img\
* 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).

kempo

Quote from: StarGeek on May 25, 2014, 03:38:24 PM
The path shown in the video is c:\gps\img.  The path in the screen shot is c:\img\.

By mistake, after I have done the video, I have deleted the c:\gps\img. folder.

Today I have created a new one, this time at c:\img\.

I can put back the "img" folder in the "gps" folder.

StarGeek

If the images are in C:\img\ then just ignore me.  It was just a discrepancy I had noticed.
* 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).

kempo

Quote from: StarGeek on May 25, 2014, 03:54:42 PM
If the images are in C:\img\ then just ignore me.  It was just a discrepancy I had noticed.

I can confirm that the images and the position_data.txt file are in c:\img\ .

Phil Harvey

Thanks.

The problem is that the full path derived from the database entries has a capital "C:", while the path for the file has a lower-case "c:".   Both are obtained by calling Cwd::abs_path() ... darned inconsistencies in this function :(

Can I always assume case-insensitivity for a Windows filesystem?  If so, then I can deal with this.

- Phil

Edit: I did a bit of googling, and it appears to be a reasonable assumption that all Windows filesystems are case insensitive.  (Perhaps not some NTFS-mounted volumes, but assuming these are case-insensitive too would be unlikely to cause any problems.)  So I will add a patch for this in ExifTool 9.63.
...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 ($).

kempo

Hi Phil, after v9.63 will be available I will do some trials.

Regarding my request from above : it is possible to have on the KML file the picture/tags at the height mentioned in the EXIF (there is an example in a previous post)?

Thank you,
Alex

Phil Harvey

Hi Alex,

You can do anything you want in the KML.  The example I gave is very basic.  Just edit the kml.fmt file to do whatever you want.  For help with the KML format, I suggest a Google Earth forum.

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

Amrit

Hi Phil

I have the same  issues and wondering if there is other solution to this. I am trying to modify the GPS coordinates of pictures with corrected GPS coordinates.

I saw this link but not sure if there is a solution.

Thanks


Phil Harvey

You'll have to be more specific.  The case-sensitivity problem should have been solved in ExifTool 9.63.

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

Amrit

The problem is not solved I have the same issue


Phil Harvey

I can't see the whole -v2 output.  At the start it should say what entries were imported from the database.  Compare these file names with the ones from the processed files.

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

Amrit


StarGeek

Just to verify, you are using a recent version of exiftool?  Type exiftool -ver to check.
* 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).


Amrit

Hi Phil

Manage to get it work Source file as below 
SourceFile,GPSLatitude,GPSLongitude
C:\Users\raj_am\Desktop\Images\P7270104.jpg,18.156476,178.447978

Thanks again

vlad_rostov

Sorry for necroposting, but i can't get it to work.
Tried adding "./" to filenames in source file and specifying the full path to images as Amrit done (also in lower case) - but nothing worked.
I'm using ExifTool ver 12.01 on Win 10 Home.
Please find command line output attached and first few lines of coords.txt below^
SourceFile,GPSLongitude,GPSLatitude,GPSAltitude,Accuracy_X/Y_(m),Accuracy_Z_(m),X_est,Y_est,Z_est
c:\users\asus\desktop\28\kriv\dsc00598.jpg,42.715884,47.752518,179.996000,0.020000,0.021000,,,
c:\users\asus\desktop\28\kriv\dsc00599.jpg,42.715862,47.752531,179.387000,0.020000,0.020000,,,
c:\users\asus\desktop\28\kriv\dsc00600.jpg,42.715797,47.752545,179.109000,0.020000,0.020000,,,
c:\users\asus\desktop\28\kriv\dsc00601.jpg,42.715691,47.752554,179.041000,0.020000,0.020000,,,
c:\users\asus\desktop\28\kriv\dsc00602.jpg,42.715510,47.752570,178.844000,0.020000,0.020000,42.715509,47.752571,178.843539
c:\users\asus\desktop\28\kriv\dsc00603.jpg,42.715199,47.752597,179.148000,0.020000,0.019000,42.715200,47.752597,179.140831
c:\users\asus\desktop\28\kriv\dsc00604.jpg,42.714839,47.752626,179.816000,0.021000,0.020000,42.714840,47.752627,180.140705
c:\users\asus\desktop\28\kriv\dsc00605.jpg,42.714517,47.752652,180.129000,0.021000,0.020000,42.714518,47.752652,180.209676
c:\users\asus\desktop\28\kriv\dsc00606.jpg,42.714198,47.752678,180.390000,0.021000,0.020000,42.714198,47.752678,180.330282

Phil Harvey

Hi Vlad,

Try changing the backslashes in the CSV SourceFile column to forward slashes.

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

vlad_rostov

Thank you, Phil. It worked like a charm

--
Best regards,
Vlad

Quote from: Phil Harvey on September 11, 2020, 09:29:53 AM
Hi Vlad,

Try changing the backslashes in the CSV SourceFile column to forward slashes.

- Phil

vlad_rostov

Quote from: vlad_rostov on September 11, 2020, 10:08:05 AM
It worked like a charm

I was wrong. I saw no errors in cmd output and saw that new jpgs were created and original ones backed up. But in fact only GPS references were written, but not the coordinates.
And I can't reproduce this result on either of two Win 10 machines I have in office at the moment. Now I get only the same result as posted previously.

Phil Harvey

You should pay attention to the ExifTool error messages.  I get this when I try your CSV file:

Invalid tag name 'Accuracy_X/Y_(m)' in CSV file

Try removing the columns in the CSV which give errors like this.

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

vlad_rostov

Quote from: Phil Harvey on September 15, 2020, 10:43:02 AM
Try removing the columns in the CSV which give errors like this.

It was the point, thank you, Phil. At first I noticed this error, but later forgot to try removing columns. Sorry, I shouldn't beat the rush.

--
Best regards,
Vlad

StarGeek

The main problem was the parenthesis and the slash.  Without those, exiftool would have simply ignored those columns because they would have been non-existent tag names.  At least that's what my quick test showed.
* 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).

Phil Harvey

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

vlad_rostov

Quote from: StarGeek on September 16, 2020, 12:17:28 PM
The main problem was the parenthesis and the slash.  Without those, exiftool would have simply ignored those columns because they would have been non-existent tag names.  At least that's what my quick test showed.

Yes, it works that way, too. Thanks for clarification.

--
Best regards,
Vlad