不丢失精度的获取照片的Gps经纬度
不丟失精度的獲取照片的Gps經緯度
- 1. 實際照片存儲經緯度
- 2. **用pyhton exifread讀取**
- 3. 用java metadata-extractor讀取
- 4. windows用 exiftool命令行讀取
- 參考
查了超多的資料,發現照片的GPS信息是以rational64u 有理數的格式存儲的。如經度、緯度度,在Exif中是以3個浮點數,度,分,秒來存儲的。
而讀取出來后,也將是用有理數表示, 如 40可以表示為 40,1
1. 實際照片存儲經緯度
2. 用pyhton exifread讀取
ExifRead 2.3.2
GPS GPSLatitudeRef N
GPS GPSLatitude [40, 0, 638031/20000]
lat except: [40, 0, 638031/20000] 40.00886154166667
GPS GPSLongitudeRef E
GPS GPSLongitude [116, 23, 11610717/1000000]
lon except: [116, 23, 11610717/1000000] 116.3865585325
3. 用java metadata-extractor讀取
<!--獲取相機exif信息-->
<dependency><groupId>com.drewnoakes</groupId><artifactId>metadata-extractor</artifactId><version>2.16.0</version>
</dependency>
經度 GPS Latitude : 40° 4’ 22.74", °轉dec: 40.07298333333333
緯度 GPS Longitude : 116° 20’ 37.01", °轉dec: 116.34361388888888
4. windows用 exiftool命令行讀取
exiftoo下載:https://exiftool.org/
D:\pyproject>“exiftool(-k).exe” -v E:/BaiduNetdiskDownload/images/IMG_20201220_171156.jpg
| 13) GPSInfo (SubDirectory) -->
| + [GPS directory with 10 entries]
| | 0) GPSVersionID = 2 2 0 0
| | 1) GPSLatitudeRef = N
| | 2) GPSLatitude = 40 0 31.90155 (40/1 0/1 31901550/1000000)
| | 3) GPSLongitudeRef = E
| | 4) GPSLongitude = 116 23 11.610717 (116/1 23/1 11610717/1000000)
| | 5) GPSAltitudeRef = 1
| | 6) GPSAltitude = 0 (0/100)
| | 7) GPSTimeStamp = 9 11 56 (9/1 11/1 56/1)
| | 8) GPSProcessingMethod = CELLID
| | 9) GPSDateStamp = 2020:12:20
參考
- https://exiftool.org/TagNames/EXIF.html
- https://exiftool.org/TagNames/GPS.html
- https://stackoverflow.com/questions/1976500/how-to-get-raw-jpeg-data-but-no-metatags-proprietary-markers
- https://stackoverflow.com/questions/27080961/how-to-remove-exif-tags-using-android-exifinterface
- https://www.rmnof.com/article/exiftool-introduction/
- https://exiftool.org/verbose.html
總結
以上是生活随笔為你收集整理的不丢失精度的获取照片的Gps经纬度的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 留学中介多少钱啊?
- 下一篇: Java对点、线、面生成栅格瓦片jpg,