Adding GPS coordinates

Started by tdavid66, August 11, 2018, 12:14:41 PM

Previous topic - Next topic

tdavid66

I must be missing something.  I have scoured the boards and I can get nothing to work.

This is my existing exif info:
ExifTool Version Number         : 11.08
File Name                       : 0000009.jpg
Directory                       : .
File Size                       : 2.0 MB
File Modification Date/Time     : 2018:08:11 11:55:00-04:00
File Access Date/Time           : 2018:08:11 11:55:00-04:00
File Creation Date/Time         : 2018:08:11 11:50:40-04:00
File Permissions                : rw-rw-rw-
File Type                       : JPEG
File Type Extension             : jpg
MIME Type                       : image/jpeg
Exif Byte Order                 : Big-endian (Motorola, MM)
Make                            : HP
Camera Model Name               : HP Scanjet G3010
X Resolution                    : 600
Y Resolution                    : 600
Resolution Unit                 : inches
Modify Date                     : 1899:06:06 10:07:55
Y Cb Cr Positioning             : Co-sited
Reference Black White           : 0 255 128 255 128 255
Exif Version                    : 0220
Date/Time Original              : 2008:06:06 10:07:55
Create Date                     : 2008:06:06 10:07:55
Components Configuration        : Y, Cb, Cr, -
Sub Sec Time Original           : 00
Sub Sec Time Digitized          : 00
Flashpix Version                : 0100
Color Space                     : sRGB
Exif Image Width                : 2872
Exif Image Height               : 1964
Saturation                      : Normal
Sharpness                       : Normal
Device Setting Description      : (Binary data 200 bytes, use -b option to extract)
Padding                         : (Binary data 2060 bytes, use -b option to extract)
Current IPTC Digest             : 8e66f18955f590738ad1b11314e50ed9
Coded Character Set             : UTF8
Credit                          : TBD
Application Record Version      : 4
Date Created                    : 2008:06:06
Time Created                    : 10:07:55+00:00
IPTC Digest                     : 8e66f18955f590738ad1b11314e50ed9
About                           : uuid:faf5bdd5-ba3d-11da-ad31-d33d75182f1b
Image Width                     : 2872
Image Height                    : 1964
Encoding Process                : Baseline DCT, Huffman coding
Bits Per Sample                 : 8
Color Components                : 3
Y Cb Cr Sub Sampling            : YCbCr4:2:2 (2 1)
Date/Time Created               : 2008:06:06 10:07:55+00:00
Image Size                      : 2872x1964
Megapixels                      : 5.6
Create Date                     : 2008:06:06 10:07:55.00
Date/Time Original              : 2008:06:06 10:07:55.00


I am trying to geotag this photo using a kml file from google that contains the following info:
<?xml version="1.0" encoding="UTF-8"?>
<kml xmlns="http://www.opengis.net/kml/2.2" xmlns:gx="http://www.google.com/kml/ext/2.2" xmlns:kml="http://www.opengis.net/kml/2.2" xmlns:atom="http://www.w3.org/2005/Atom">
<Document>
<name>Villa Barolo.kml</name>
<Style id="s_ylw-pushpin_hl">
<IconStyle>
<scale>1.3</scale>
<Icon>
<href>http://maps.google.com/mapfiles/kml/pushpin/ylw-pushpin.png</href>
</Icon>
<hotSpot x="20" y="2" xunits="pixels" yunits="pixels"/>
</IconStyle>
</Style>
<Style id="s_ylw-pushpin">
<IconStyle>
<scale>1.1</scale>
<Icon>
<href>http://maps.google.com/mapfiles/kml/pushpin/ylw-pushpin.png</href>
</Icon>
<hotSpot x="20" y="2" xunits="pixels" yunits="pixels"/>
</IconStyle>
</Style>
<StyleMap id="m_ylw-pushpin">
<Pair>
<key>normal</key>
<styleUrl>#s_ylw-pushpin</styleUrl>
</Pair>
<Pair>
<key>highlight</key>
<styleUrl>#s_ylw-pushpin_hl</styleUrl>
</Pair>
</StyleMap>
<Placemark>
<name>Villa Barolo</name>
<LookAt>
<longitude>-75.13265800002498</longitude>
<latitude>40.25090199998273</latitude>
<altitude>0</altitude>
<heading>-1.614608584044955e-011</heading>
<tilt>0</tilt>
<range>995.9075127370137</range>
<gx:altitudeMode>relativeToSeaFloor</gx:altitudeMode>
</LookAt>
<styleUrl>#m_ylw-pushpin</styleUrl>
<Point>
<gx:drawOrder>1</gx:drawOrder>
<coordinates>-75.13265800002499,40.25090199998273,0</coordinates>
</Point>
</Placemark>
</Document>
</kml>


with the following command line:

exiftool -geotag vb.kml "-geotime<datetimeoriginal" 0000009.jpg

And getting the following results:

Warning: No track points found in GPS file 'vb.kml' in File:Geotag (ValueConvInv)
Warning: GPS track is empty in File:Geotime (ValueConvInv) - 0000009.jpg
Warning: No writable tags set from 0000009.jpg
    0 image files updated
    1 image files unchanged


Do I need to do something to the kml file?  From google it's basically right click and save as kml/kmx.

StarGeek

See Geotag Troubleshooting #1.

There's no timing info in that KML file.  In order to geotrack, exiftool needs to be able to figure out where the image was taken at the time indicated in the file, in this case 2008:06:06 10:07:55 ± TZ difference from UTC.  If the track was supposed to be in the same TZ as your computer, then it would be trying to figure out where the image was taken at 2008:06:06 14:07:55 UTC in the KML file.  This timing info doesn't exist so exiftool can't geotag.
* 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).

Alan Clifford

There's no track, just one set of co-ordinates. 

The command

exiftool testcoord.jpg -gpslatitude=40.25090199998273  -gpslongitude=75.13265800002499 -gpslatituderef=N -gpslongituderef=W

put the co-ordinates into the photo testcoord.jpg.  I've tested and, at least, Nikon ViewNX finds the place in its map view without adding a -gpsdatestamp and -gpstimestamp.

StarGeek

Quote from: Alan Clifford on August 11, 2018, 03:41:33 PM
There's no track, just one set of co-ordinates. 

Heh, you're more observant than me.  I just saw the error message, looked for a timestamp in the file, and went with that.
* 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).

tdavid66

Thank you both!  I will write a little PowerShell wrapper around the kml and exiftool to get my file where in needs to be.

StarGeek

Quote from: tdavid66 on August 12, 2018, 05:19:14 AM
I will write a little PowerShell wrapper around the kml and exiftool to get my file where in needs to be.

It is possible to write the Latitude/Longitude from the KML file directly without having to create a wrapper.  As long as the files are single point files as per your example, you could do this:

exiftool -TagsFromFile vb.kml "-GPSLatitude<KmlDocumentPlacemarkLookAtLatitude" "-GPSLongitude<KmlDocumentPlacemarkLookAtLongitude" "-GPSLatitudeRef<KmlDocumentPlacemarkLookAtLatitude" "-GPSLongitudeRef<KmlDocumentPlacemarkLookAtLongitude" 0000009.jpg

Exiftool can pull individual data from a KML file, just run exiftool vb.kml to see the tag names you can use.  The only problem would be KML files with more than one location, I'm not sure how those would work.  I'm guessing it would be the last point in the file, though.
* 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).