本文介绍了EXIF只返回纬度和放大器; LON作为整数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

通过我的应用程序,我上传图片到数据库中。与图像我想捕捉图像的拍摄使用EXIF数据的位置。当我测试了我的手机上的纬度和经度没有上传,但只有一个圆形的正数。

Through my app I upload images to a database. With the images I want to capture the location the image was taken by using the exif data. When I tested on my phone the lat and lon did upload but only to a rounded positive number.

在我期待的纬度位置= 52.4和LON = -1.9 IM实际上得到土地增值税= 52和LON 1

When I'm expecting a location of Lat = 52.4 and lon = -1.9 im actually getting lat = 52 and lon 1

下面是我的code;纬度和经度都是字符串:

Here is my code; lat and lon are both String:

ExifInterface exif = new ExifInterface(mainMenu.filename);    
lat = exif.getAttribute(ExifInterface.TAG_GPS_LATITUDE);
lon = exif.getAttribute(ExifInterface.TAG_GPS_LONGITUDE);

我的数据库值保持在纬度和经度的双打,我也试着浮动。

My database values for holding the lat and lon are doubles and I've also tried float.

推荐答案

综观的文档,你不应该改为使用 getLatLong(浮动[]输出)方法?

Looking at the documentation for ExifInterface, shouldn't you instead be using the getLatLong(float[] output) method?

float[] latLong = new float[2];
if (exif.getLatLong(latLong)) {
    // latLong[0] holds the Latitude value now.
    // latLong[1] holds the Longitude value now.
}
else {
    // Latitude and Longitude were not included in the Exif data.
}

这篇关于EXIF只返回纬度和放大器; LON作为整数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-12 00:55