## GPS Rational data problem

Added by Nick Man over 9 years ago

Hi all,

I'd ask your help with this problem when I try to write back GPS data to the EXIF. That's clear that the Latitude&Longitude data has to be inserted in the rational format.

Let's say the correct data is: "12/1 22.54/1 0/1" (note: no seconds value)

If I try to use this - exiv2 -M"set Exif.GPSInfo.GPSLatitude 12/1 22.54/1 0/1" - then exiv2 dies with:

Warning: Exif.GPSInfo.GPSLatitude: Failed to read Rational value "12/1 22.54/1 0/1"

If remove/round the numbers - exiv2 -M"set Exif.GPSInfo.GPSLatitude 12/1 22/1 0/1" - exiv2 writes the data perfectly.

The problem is this 0.54 minutes difference is noticeable and significant change in the accurate position.

Mathematically I can change 0.54 minutes to 32.4 seconds, but the "12/1 22/1 32/1" again gives inaccurate results.

So the question is, how can I make exiv2 work to accept fractions when writing the GPS data?

Many thanks in advance.

nm

### Replies (2)

#### RE: GPS Rational data problem - Added by Andreas Huggel over 9 years ago

Hi Nick,

These are just general rational numbers, both nominator and denominator are integers but the denominator doesn't need to be 1. So try 2254/100 (or 22/1 and 324/10) and you should get the correct coordinates. (And yes, the interface is clumsy, there is certainly room for improvement.)

Andreas

#### RE: GPS Rational data problem - Added by Nick Man over 9 years ago

Hi Andreas,

Thanks for the help, you're right with the denominator value. I set up some quick script to calculate the correct denominator based on the fractions, so now everything seems to be smooth.

Thanks again and keep the good work! :)

nm