ExifTool Forum

ExifTool => ExifTool GUI => Topic started by: at on February 07, 2023, 08:44:51 AM

Title: Add GPS and Orientation information to image from txt
Post by: at on February 07, 2023, 08:44:51 AM
Hello,
I have photos and a txt file. In this txt file, respectively, in the form of columns; photo name, Latitude, Longitude, Height, Omega, Phi Kappa information available. I want to load these 6 information from txt file inside each photo. how can I do that?

I am attaching a photo and txt file as an example.( https://sendgb.com/s1hQZ08VIne )

Thank you.
Title: Re: Add GPS and Orientation information to image from txt
Post by: Phil Harvey on February 07, 2023, 12:36:12 PM
Two things:

1. I don't know where you want to store Omega,Phi,Kappa, so for now I have assumed the PoseRotationZ,PoseRotationX,PoseRotationY XMP tags.

2. If you change the spaces to commas in your file and change the header items to SourceFile plus the tag names you want to write, then this command should do what you want:

exiftool exiftool 900.jpg -csv=calibrated_external_camera_parameters_wgs84.txt

Here is the text file:

SourceFile,GPSLongitude,GPSLatitude,GPSAltitude,PoseRotationZ,PoseRotationX,PoseRotationY
900.jpg,40.44808401,39.36133942,7472.36736932,35.93866393,0.66784925,-179.55207030

- Phil
Title: Re: Add GPS and Orientation information to image from txt
Post by: at on February 08, 2023, 01:08:35 AM
Thank you for the help.
I'm going to give it a try for the first time with the command. so i have a few questions.

exiftool exiftool *.jpg -csv=calibrated_external_camera_parameters_wgs84.txt

I am running the above command. i changed the title of my txt file like this. (https://exiftool.org/forum/index.php?topic=8078.0)

SSourceFile,GPSLongitude,GPSLatitude,GPSAltitude,CameraPitch ,CameraRoll ,CameraYaw
900.jpg,40.44808401,39.36133942,7472.36736932,35.93866393,0.66784925,-179.55207030
901.jpg,40.45278790,39.36132062,7468.83117771,35.90606046,0.63411322,-179.43836378

but the last three lines are not written to the exif information. I looked at the tag names for jpg and couldn't find such a name. (https://exiftool.org/TagNames/index.html)


How can I write this orientation information in it?

I'm putting a sample picture in this data, the information I want is recorded.  (https://sendgb.com/Kwc9o86EeUS)

Thank you
Title: Re: Add GPS and Orientation information to image from txt
Post by: Phil Harvey on February 08, 2023, 07:17:47 AM
I'm not sure which Pitch/Yaw/Roll tags you want to write.  Your sample file contains two sets -- both proprietary PhaseOne XMP tags.  Here is the XMP from the file:

<?xpacket begin="�" id="W5M0MpCehiHzreSzNTczkc9d"?>
<x:xmpmeta xmlns:x="adobe:ns:meta/" x:xmptk="XMP Core 5.5.0">
 <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
  <rdf:Description rdf:about=""
    xmlns:exif="http://ns.adobe.com/exif/1.0/"
    xmlns:aerialgps="http://www.phaseone.com/aerialgps/"
    xmlns:Camera="http://www.phaseone.com/camera/"
    xmlns:rangefinder="http://www.phaseone.com/rangefinder/"
    xmlns:tiff="http://ns.adobe.com/tiff/1.0/"
    xmlns:aux="http://ns.adobe.com/exif/1.0/aux/"
    xmlns:photoshop="http://ns.adobe.com/photoshop/1.0/"
    xmlns:xmp="http://ns.adobe.com/xap/1.0/"
   exif:GPSDateStamp="2022-09-14"
   exif:GPSTimeStamp="2022-09-14T07:36:12+00:00"
   exif:GPSLatitude="40,55.258542N"
   exif:GPSLongitude="38,23.541024E"
   exif:GPSAltitudeRef="0"
   exif:GPSAltitude="304857/1000"
   exif:GPSSpeedRef="K"
   exif:GPSSpeed="30/100"
   exif:GPSTrackRef="T"
   exif:GPSTrack="4266/100"
   aerialgps:GPSIMUPitch="-900336/10000"
   aerialgps:GPSIMURoll="-121/10000"
   aerialgps:GPSIMUYaw="1649/10000"
   aerialgps:GPSIMUYawRef="T"
   aerialgps:GPSFlightLatitude="40,55.258506N"
   aerialgps:GPSFlightLongitude="38,23.541024E"
   aerialgps:GPSFlightAltitudeRef="0"
   aerialgps:GPSFlightAltitude="304997/1000"
   aerialgps:GPSLatitudeAccuracy="128792/10000000"
   aerialgps:GPSLongitudeAccuracy="140264/10000000"
   aerialgps:GPSAltitudeAccuracy="44/1000"
   aerialgps:GPSRelativeAltitude="-1000/1000"
   aerialgps:GPSIMUFlightPitch="0/10000"
   aerialgps:GPSIMUFlightRoll="0/10000"
   aerialgps:GPSIMUFlightYaw="0/10000"
   aerialgps:GPSIMUFlightYawRef="T"
   Camera:Roll="359.987915"
   Camera:Pitch="359.966400"
   Camera:Yaw="0.164907"
   Camera:YawRef="T"
   Camera:TargetRoll="-90.000000"
   Camera:TargetPitch="0.000000"
   Camera:TargetYaw="352.299896"
   Camera:ControlMode="a"
   Camera:GPSXYAccuracy="0.014026"
   Camera:GPSZAccuracy="0.044000"
   Camera:AboveGroundAltitude="-1.000000"
   rangefinder:RangeFinderDistance="180000/1000"
   tiff:Make="Phase One"
   tiff:Model="iXM-100"
   aux:SerialNumber="ML011127"
   aux:LensInfo="35/1 35/1 157511/28127 1029841/46811"
   aux:Lens="Phase One RSM 35mm f/5.6"
   aux:LensSerialNumber="UG001279"
   aux:ImageNumber="3239"
   aux:Firmware="iXM-100, v4.23.9 (FWR)"
   photoshop:DateCreated="2022-09-14T10:38:25"
   photoshop:LegacyIPTCDigest="28FE7651EB1B2A74D5DC69877790FAB1"
   xmp:CreateDate="2022-09-14T10:38:25"
   xmp:CreatorTool="Capture One 22 Windows"/>
 </rdf:RDF>
</x:xmpmeta>
<?xpacket end="w"?>

You'll need to use a config file with user-defined tags for the XMP that you want to write.  I don't have time to write a config file for you right now, but it isn't too hard.  See the XMP-xxx tags in the example config file (https://exiftool.org/config.html) for examples.  You'll want to add definitions for the aerialgps and/or Camera namespaces.

- Phil
Title: Re: Add GPS and Orientation information to image from txt
Post by: Phil Harvey on February 08, 2023, 08:37:35 AM
Ah ha!  I did find that Albert Wu has already created a config file for the aerialgps tags.  This may be all that you need:

See this post. (https://exiftool.org/forum/index.php?msg=75396)

- Phil

Edit: I see the config file in that post is incomplete, and isn't defining some tags as rational format like in your sample.  I have attached a config file that is more complete.