获取照片的GPS位置 [英] Get gps location of a photo

查看:338
本文介绍了获取照片的GPS位置的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我知道如何让手机的当前GPS位置。
我也知道如何将GPS位置保存到照片时,你把它。 (相机选项三星Galaxy S2)。

I know how to get the current GPS location of a mobile phone. I also know how to save the GPS location to the photo when you take it. (Camera option Samsung galaxy s2).

但我怎么能得到的照片(后下)的GPS位置?
当我打开电脑上的照片,我可以看到GPS定位数据,但有不知道如何在以后的android提取它们。因此,能不能有人把我放在好的方向发展?
为了使问题更清楚:
我怎样才能得到一个已经拍摄照片的GPS位置?

But how can I get the GPS location of that photo (later)? When I open the photo on the computer, I can see the GPS location data, but got no idea how to extract them later in android. So could someone put me in the good direction? To make question more clearly: How can I get the GPS location of a photo that is already taken?

感谢不已,
Bigflow

Thanks already, Bigflow

推荐答案

josnidhin做出这样的回答可能,所以一定要给他贷款太:)

josnidhin made this answer possible, so be sure to give him credit too :)

在这里,我们去:

import android.media.ExifInterface;

exif = new ExifInterface(filePath);
String lat = ExifInterface.TAG_GPS_LATITUDE;
String lat_data = exif.getAttribute(lat);

在此之后,lat_data会是这样的:51 / 1,58 / 1,32 / 1

After that, lat_data will be something like: 51/1,58/1,32/1

这是一样的:51,58,32(输入这个在谷歌地图会给坏的结果)

This is the same as: 51, 58, 32. (typing this in google maps will give bad result)

要获得这一点,你需要做一些数学的GPS坐标,就到这里吧:

To get the gps coordinates of this you need to do some math, here it comes:


  1. 计算的总秒数:搜索
    58'32=(58 * 60 + 32)= 3512
    秒。

  2. 小数部分的秒除以3600总人数:结果
    三千六百分之三千五百十二=〜0.975556

  3. 添加小数度到全度产生最终结果:结果
    51 + 0.975556 = 51.975556

  4. 如果它是一个西经坐标,否定的结果。 (这是不是这一次)

  5. 回答:51.975556

这也是同样的,当你使用 TAG_GPS_LONGITUDE

This is also the same when you with TAG_GPS_LONGITUDE

这篇关于获取照片的GPS位置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆