【问题标题】:In what forms does Android return EXIF GPS data?Android 以什么形式返回 EXIF GPS 数据?
【发布时间】:2013-07-10 22:42:16
【问题描述】:

我使用的是安卓手机拍摄的照片中的 EXIF 数据,通常获取 GPS 数据非常简单,它以简单的 [双纬度,双经度] 格式返回,效果很好。但有时它会给我一些没有意义的数字,例如 [247322, 124390],我猜这是因为它以不同的格式将它们返回给我,但我不确定是什么。

您知道 EXIF GPS 数据返回的不同格式吗?

这是我的代码:

            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
                }
            }

感谢您的帮助!

【问题讨论】:

    标签: java android gps exif


    【解决方案1】:

    您在 GetImageGps 中使用的是 ExifInterface 吗?

    尝试这样的事情(确保使用 getLatLong 方法)

    
    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
    }
    
    

    【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2011-02-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2018-08-18
    • 2015-07-10
    • 2017-04-04
    相关资源
    最近更新 更多