Geotag: Read XMP data and convert into "Lite" XMP with only GPS infos

Started by d82k, April 11, 2012, 08:16:46 AM

Previous topic - Next topic

d82k

Dear All,

this tool is amazing, it has a lot of features!

What I would like to do is this:
I have a long list of XMP files with a lot of information in it (too much) and I would like to convert each one of them in to a minimal "lite" version of it like this:

<x:xmpmeta xmlns:x='adobe:ns:meta/'>
<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/'>
  <exif:GPSAltitude>[ ORIGINAL_VALUE ]</exif:GPSAltitude>
  <exif:GPSAltitudeRef>[ ORIGINAL_VALUE ]</exif:GPSAltitudeRef>
  <exif:GPSLatitude>[ ORIGINAL_VALUE ]</exif:GPSLatitude>
  <exif:GPSLongitude>[ ORIGINAL_VALUE ]</exif:GPSLongitude>
  <exif:GPSMapDatum>[ ORIGINAL_VALUE ]</exif:GPSMapDatum>
  <exif:GPSTimeStamp>[ ORIGINAL_VALUE ]</exif:GPSTimeStamp>
  <exif:GPSVersionID>[ ORIGINAL_VALUE ]</exif:GPSVersionID>
</rdf:Description>

</rdf:RDF>
</x:xmpmeta>


All values are inside all files already.

I was wondering if there is a method of doing this, for example using a similar technique as reverse geocoding http://www.exiftool.org/geotag.html#Reverse using the template above described but instead of saving all these into a single text file, generate a new file with the $filename of the just opened XMP.

Do you have any idea or advice?
the alternate solution would be extract all data into cvs format and using an excel macro generate xmp files.. but I was wondering if there is a method of doing this automatically with a couple of commands lines with ExifTool.

Why I need to do all this?
Unfortunately my photo GPS is generating proprietary file with track information, and I need to use its software in order to geotag photos.
This generates a big XMP which I don't really like because it adds a lot of data that makes confusion and I have to remove manually using Lightroom.

So what I did is through reverse geotagging feature creating gpx file from all the XMP I have, and then recreate xmp based on time stamps.
The thing is that the gps proprietary software matches coordinates and photos also if the camera and gps are not synchronized (strange but it works).
Therefore this method does not work.. I should have to calculate the difference, apply the correction and than merge infos.

Thank you for your advices,
dk

Phil Harvey

You can do this with a command like this:

exiftool -tagsfromfile @ -gpsaltitude -gpsaltituderef -gpslongitude ... -ext xmp -srcfile %d%f_light.xmp DIR

This command will create "*_light.xmp" files for each XMP file in directory "DIR".

To save typing, you can add all of your tag names to a separate file and type -@ mytags.txt on the command line.  The "mytags.txt" file will look like this:

-gpsaltitude
-gpsaltituderef
-gpslongitude
...


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

d82k

Hey Phil!

wow super fast answer! It is exactly what I wanted!!!
I put everything in a .bat file and works great!

Thank you so much for your help, exiftool is really powerful!

have a nice day,
dk

Phil Harvey

Great, glad it worked.

You're no newbie to .bat files though, because you didn't have the usual "%%" problem... ;)

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

d82k

 ;)

I also share my .bat file, maybe it can be useful also to someone else.

If placed and executed in the folder with .xmp, it creates a new folder with light .xmp with original name.

md light
exiftool -tagsfromfile @ -gpsaltitude -gpsaltitudeRef -gpslatitude -gpslongitude -gpsmapdatum -gpstimestamp -gpsversionid -ext xmp -srcfile %%dlight/%%f.xmp %cd%
pause


Thank you again,
dk

Phil Harvey

Thanks for the .bat file.

It points out an interesting quirk that I didn't realize.  ExifTool normally creates output directories as necessary, but not when the -srcfile option is used.  I'll look into 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 ($).

d82k

 :P eh eh a hint for the next version!
have a nice weekend Phil!