Updating Metadata from CSV - GIS application

Started by allthepaint, October 06, 2021, 01:00:07 PM

Previous topic - Next topic

allthepaint

New to ExifTool, I have a batch of 423 jpg images from a pegasus (Leica) backpack.  The goal is to update the metadata in the images to match an Exterior Orientation csv.  In this particular case I need to add Z values to the imagery.  I can successfully update the images from the csv, but only the present metadata tags already in the images are updating.  I am not very experienced with this kind of task and I am wondering if I need to add the tags from the csv in order to embed that information in my images.  Is there a simple process I can follow that will write all the data from the csv directly to the images?  I have been studying the tool for a while now and am not understanding what steps I need to follow to replace the metadata in my images with the data from my Exterior Orientation file. 

The end goal is to create an oriented imagery catalog that displays the images along the path that was followed, with precise gps and elevation data, then cloud store it and link it to an online WebScene. 

StarGeek

Quote from: allthepaint on October 06, 2021, 01:00:07 PMIn this particular case I need to add Z values to the imagery.  I can successfully update the images from the csv, but only the present metadata tags already in the images are updating.

Do you know the actual tag you want to update?  If so, you just need to add a column in the CSV file for that tag with the correct data for each file and use the same command that you used that successfully updated the files.

QuoteI am wondering if I need to add the tags from the csv in order to embed that information in my images.  Is there a simple process I can follow that will write all the data from the csv directly to the images?

Although I may be misunderstanding.  When you say you updated the images from the CSV file, did you use the -csv option with exiftoo or something else?

As long as the CSV files formatted in a form that exiftool can read (see the above link and FAQ #26 for details and run exiftool with the -csv option on a single file for an example), it can add any data that exiftool can write.


* 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).

allthepaint

Yea I updated from the csv using -csv command.  when I look at the image details though, I don't see any of the fields in the csv except my lat and long values.  Is there a chance it did what I needed but I am not seeing the fields?


StarGeek

I couldn't say without more info.

What is the exact command you used?

What do the first two lines of your csv file look like?
* 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).

allthepaint

#4
Understandable.  I have attached a couple of screencaps showing the exif data of one of the updated images and another with an example of the csv format from excel.  I am having a hard time understanding what happened during the process...  The commands I used were:

D:\LeavenworthTunnels_OIC\TempExifData>exiftool -hardlink=%f.%e -r D:\LeavenworthTunnels_OIC\TunnelSinglePassSphere
    1 directories scanned
    0 image files updated
  423 image files unchanged
  423 hard links created

D:\LeavenworthTunnels_OIC\TempExifData>exiftool -csv=D:\LeavenworthTunnels_OIC\TempExifData\ExternalOrientation_Processed.csv D:\LeavenworthTunnels_OIC\TempExifData
    1 directories scanned
  423 image files updated

The thing that is bothering me is not seeing the z values appear in my images, I can rename fields to whatever is needed but I am not comprehending how to attain the purpose I think.  It wouldn't be a big deal in an ordinary situation to not have the elevation of an image, but these were done in underground tunnels and I would like to show that dimensionality in the 3d scene I want to create.  The software platform we are using attaches photos that do not have altitude or elevation data directly to a hosted ground level surface.  My goal is to use the orientation data that I have to place these photos below the hosted surface and along the path our data collection followed, so that I can potentially add these to our lidar data in an easily accessible location for clients.  It's an R&D exercise for me at the moment, but if I can follow a repeatable batch process on our imagery I can complete a workflow to reproduce this ability in future scenarios.  I have every other step in the process figured out (except reliable cloud storage>hosting) and I am literally so stuck on the constraints of the Exif data in these images.  Any guidance or help is much appreciated, I try to learn something new everyday.

allthepaint

I am not sure if this is correct but I just found the GPS Tags documentation and it leads me to think I need to rename the field Z in my file to GPSAltitude, as well as adding the reference.  Does that sound like a possible reason why I am struggling?

I think I just assumed that I could write any field into the Exif tables and I am actually limited to certain options with jpg's, right?

StarGeek

Quote from: allthepaint on October 06, 2021, 03:11:41 PM
I am not sure if this is correct but I just found the GPS Tags documentation and it leads me to think I need to rename the field Z in my file to GPSAltitude, as well as adding the reference.  Does that sound like a possible reason why I am struggling?

Yes, you have to use the name of actual tags.  You cannot write values to arbitrary names.  Exiftool has to have a definition to know how to write the tag, where to write the tag, and what are valid values for the tag.

QuoteI think I just assumed that I could write any field into the Exif tables and I am actually limited to certain options with jpg's, right?

Yes and no.  You are limited to existing tags (see the 24,338 tags listed under the sub-pages of the Tag Names page) unless you write your own definition, which I don't recommend.  It also has to be a legal tag for an image file.  For example, you can't write an MP3 ID3 tag into an image.  Additionally, you can't create any of the proprietary MakerNotes which are specific to the various camera manufacturers (Canon, Nikon, etc) though they can be edited if they already exist.  But that still leaves a huge amount of tags that you can write, with the most common for images being EXIF, IPTC IIM/Legacy, and XMP (which includes IPTC core/ext).  The GPS tags are technically part of the EXIF group as they are located in that block.  They have a separate listing by they can also be written with an EXIF: prefix, i.e. -EXIF:GPSLatitude*=40.6892 -EXIF:GPSLongitude*=-74.0445 works as well as -GPS:GPSLatitude*=40.6892 -GPS:GPSLongitude*=-74.0445

Also one additional important detail.  As detailed in the fourth paragraph on the GPS tag page
   When adding GPS information to an image, it is important to set all of the following tags: GPSLatitude, GPSLatitudeRef, GPSLongitude, GPSLongitudeRef, and GPSAltitude and GPSAltitudeRef if the altitude is known

This is because the directional reference (N/S/E/W) is not stored in the same place as the coordinate numbers.  The easiest thing to do with your CSV file is to Copy/Paste the GPSLatitude, GPSLongitude, and GPSAltitude (renamed from Z) and then add Ref to the end, so you have six columns.  The actual text of the CSV file would be something like
SourceFile,GPSLatitude,GPSLongitude,GPSAltitude,GPSLatitudeRef,GPSLongitudeRef,GPSAltitudeRef
TunnelSinglePass-sphere-1.jpg,39.36043056,-94.91715278,885.739


Also problematic is the time stamp.  GPS time stamps are also split into two separate tags, GPSDateStamp and GPSTimeStamp, and are supposed to be set to UTC.  Again, you can simply duplicate the columns and change the header.  The only other problem is that it would have to be converted from 12 hour to 24 hour clock, which should be something that your spreadsheet program can do.
* 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).