I am trying to use geo-tagging with my own camera application. What I am doing is getting my current geo-location as decimal value (Ex. Latitude = 6.8447375) and want to convert it in to DMS format in order to use public static final String TAG_GPS_LATITUDE
field in the ExifInterface
. According to the Android documentation I need to give denominators (as in documentation denom1, denom2, denom3 ) What are the correct values that I have to use for those denominators? Is there any standard method to calculate those denominators. When I use denom1=1, denom2=1 and denom3=1000 I get different location near my actual location. How can I increase the accuracy ?

- 4,623
- 8
- 56
- 99
1 Answers
Are you providing the correct numerator values to go with those denominators?
num1/denom1 = degrees
num2/denom2 = minutes
num3/denom3 = seconds
I've witnessed most cameras encode the values 1,1,1000 for the denominators.
Let's use your sample value and convert it into accurate rational values:
6.8447375 degrees
Here are the steps:
1) Take the whole part of the angle
num1 = 6 / denom1 = 1 --> 6 degrees
2) Multiply the fractional part by 60 and then take the whole part of that: 0.8447375 * 60 = 50.68425
num2 = 50 / denom2 = 1 --> 50 minutes
3) Subtract 6 deg 50' (6.833333333) from your original value = 0.0114041667, then multiply by 3600000 (3600 seconds per degree x 1000)
num3 = 41055 / denom3 = 1000 -> 41.055 seconds
Your position is now encoded as 6 deg, 50' 41.055"

- 8,500
- 3
- 28
- 46
-
You have mentioned " **most cameras encode the values 1,1,1000 for the denominators** ". I am aware of the calculation what I wanted to know is about those denominators. If they are device specific, how can we get those denominators programmatic. – AnujAroshA Mar 28 '12 at 03:13
-
The denominators don't matter as long as you get the accuracy you need. That's the whole point of using rationals. As I demonstrated, the standard denominators of 1,1,1000 are perfectly fine for accurately specifying a GeoPoint. – BitBank Mar 28 '12 at 03:15