可以从图片中获取图片GPS位置坐标吗? [英] Is possible to get Image GPS location coordinates from the Image?
问题描述
我正在构建Flutter应用程序,用户可以在其中发布照片及其位置.使用者都可以从相机或图库中获取图片.
I'm building a Flutter App where the user can post a photo and it's location. The use can both get a picture from the camera or from the library.
如果用户使用相机拍照,则可以使用设备的GPS位置来设置图片的位置.我正在尝试根据图片的元数据获取图片的GSP位置,但是我还没有找到一种方法.
If the user take a picture from camera I can use the GPS location of the device to set the picture's location. I'm trying to get the GSP location of the pictures based on its metadata, but, I didn't found a way to do it yet.
有可能做到吗?最好的方法如何?
Is possible to do it? How the best way?
我在问题中输入"GPS"以使其清楚.我试图发现拍摄照片的实际位置.我还向问题中添加了"Flutter",以表明我正面临在Flutter App中解决此问题的问题.
I put "GPS" in the question to make it clear. I'm trying to discover the physical position where the picture was taken. I also added "Flutter" to the question to make it clear that I'm facing the problem of solving this problem in a Flutter App.
推荐答案
如果图像是JPEG或RAW图像文件,则地理位置元数据将存储为Exif标记.在Android中,这是通过ExifInterface
类完成的.
The geolocation metadata is stored as Exif tags provided the image is a JPEG or a RAW image file. In Android this is done through the ExifInterface
class.
标记为TAG_GPS_LATITUDE
和TAG_GPS_LONGITUDE
:
https://developer.android.com/reference/android/media/ExifInterface. html
请注意,坐标必须以有理格式表示:度,分钟和秒,以dd/1,mm/1,ss/1
表示.
Please note the coordinates need to be expressed in the rational format: degrees, minutes and seconds, as dd/1,mm/1,ss/1
.
这篇关于可以从图片中获取图片GPS位置坐标吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!