不丢失精度的获取照片的Gps经纬度
作者:互联网
不丢失精度的获取照片的Gps经纬度
查了超多的资料,发现照片的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
标签:读取,经纬度,23,exiftool,40,116,丢失,Gps,GPS 来源: https://blog.csdn.net/qq_40985985/article/details/119914219