reading freshly set gps-coordinates

Started by Archive, May 12, 2010, 08:54:44 AM

Previous topic - Next topic

Archive

[Originally posted by springm on 2010-01-21 02:04:32.938809-08]

Hi,
in a short script I want to first geotag an image and then query ws.geonames.org for the place name.
However I am unable to retrieve lat/lon values with $exifTool->GetValue('GPSLatitude') after having called SetGeoValues. I double checked, and the coordinates are really written into the image file, just retrieving them after setting fails.

Code:
$exifTool->Image::ExifTool::Geotag::SetGeoValues($exifTool->GetValue('DateTimeOriginal'),'GPS');
print $exifTool->GetValue('GPSLatitude');

Could someone please point out the mistake I am making here?

Best -- Markus

Archive

[Originally posted by exiftool on 2010-01-21 04:17:23.760044-08]

Hi Markus,

Interesting.  First you must set the value of
the 'Geotag' tag to load the GPS log file.  Then,
after calling SetGeoValues, you should be able
to call GetNewValue to retrieve the new values
that you set.  GetValue is used to retrieve the
values read from file, which isn't what you are
doing.

- Phil

Archive

[Originally posted by springm on 2010-01-21 05:11:16.370887-08]

Phil, thanks. I had overlooked this method. Now it works - and having the placenames automatically along with the coordinates is a real improvement.

Archive

[Originally posted by exiftool on 2010-01-21 05:20:26.779797-08]

For anyone else reading this (and for Marcus too), I should mention
that it isn't a good idea to call the non-public methods of the
Geotag class.  Instead of calling SetGeoValues, you should use the
public SetNewValue function for the Geotime tag to accomplish the
same thing:

Code:
$exifTool->SetNewValue('GPS:Geotime' => $exifTool->GetValue('DateTimeOriginal'));

- Phil