Android ExifInterface TAG_GPS_LATITUDE denom values

房东的猫 提交于 2019-12-11 19:46:35

问题


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 ?


回答1:


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"



来源:https://stackoverflow.com/questions/9736232/android-exifinterface-tag-gps-latitude-denom-values

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!