以什么形式做Android的回报EXIF GPS数据? [英] In what forms does Android return EXIF GPS data?
问题描述
我使用从Android手机所拍摄的照片的EXIF数据,通常是很简单的获取GPS数据,它是在一个简单的【双纬度,经度双]格式的返回,它的伟大工程。但有时它会给我的数字是没有任何意义,如[247322,124390],我猜,这是因为它是在一个不同的格式,把他们送回了我,但我不知道是什么。
I am using the EXIF data from the photos taken with Android phones and generally it is quite simple to get the GPS data and it is returned in a simple [double latitude, double longtitude] format and it works great. But sometimes it will give me numbers that don't make sense such as [247322, 124390] and I am guessing that this is because it is returning them to me in a different format but I'm not sure what.
你知道什么不同格式的EXIF GPS数据在返回?
Do you know what the different formats EXIF GPS data is returned in?
下面是我的code:
var gps = GetImageGps(filePath, currentTimeInMillisenconds);
double latitude = 0;
double longitude = 0;
if (gps != null && gps[0] != 0 && gps[1] != 0)
{
_gpsLocation = gps;
latitude = gps[0];
longitude = gps[1];
if ((latitude < -90 || latitude > 90) && (longitude < -180 || latitude > 180))
{
//here I will handle another format
}
}
感谢您的帮助!
推荐答案
您使用<一个href=\"http://developer.android.com/reference/android/media/ExifInterface.html#getLatLong%28float%5b%5d%29\"相对=nofollow>在GetImageGps ExifInterface ?
试一试像这样(请务必使用getLatLong方法)
Try it something like this (make sure to use the getLatLong method)
ExifInterface exifInterface = new ExifInterface(fileName);
float[] latLng = new float[2];
if (exifInterface .getLatLong(latLng)) { //file has exif latlong info
//etc, latLng[0] is your latitute value and latLng[1] your longitude value
}
这篇关于以什么形式做Android的回报EXIF GPS数据?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!