Skip to content

Commit 26917eb

Browse files
authored
Merge pull request #90 from SenteraLLC/image-accuracy
GPS Accuracy Function
2 parents 6478343 + 10de33d commit 26917eb

3 files changed

Lines changed: 25 additions & 1 deletion

File tree

imgparse/parser.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -602,3 +602,15 @@ def dewarp_flag(self) -> bool:
602602
raise ParsingError(
603603
"Couldn't parse dewarp flag. Sensor might not be supported"
604604
)
605+
606+
def gps_accuracy(self) -> tuple[float, float, float]:
607+
"""Get the GPS accuracy values in meters for x, y, and z."""
608+
try:
609+
x_acc = float(self.xmp_data[self.xmp_tags.X_ACCURACY_M])
610+
y_acc = float(self.xmp_data[self.xmp_tags.Y_ACCURACY_M])
611+
z_acc = float(self.xmp_data[self.xmp_tags.Z_ACCURACY_M])
612+
return x_acc, y_acc, z_acc
613+
except KeyError:
614+
raise ParsingError(
615+
"Couldn't parse GPS accuracy. Sensor might not be supported"
616+
)

imgparse/xmp_tags.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,9 @@ class XMPTags:
2929
CAPTURE_UUID: str = ""
3030
FLIGHT_UUID: str = ""
3131
DEWARP_FLAG: str = ""
32+
X_ACCURACY_M: str = ""
33+
Y_ACCURACY_M: str = ""
34+
Z_ACCURACY_M: str = ""
3235

3336

3437
class SenteraTags(XMPTags):
@@ -47,6 +50,9 @@ class SenteraTags(XMPTags):
4750
DISTORTION = "Camera:PerspectiveDistortion"
4851
CAPTURE_UUID = "Camera:CaptureUUID"
4952
FLIGHT_UUID = "Camera:FlightUUID"
53+
X_ACCURACY_M: str = "Camera:GPSXYAccuracy"
54+
Y_ACCURACY_M: str = "Camera:GPSXYAccuracy"
55+
Z_ACCURACY_M: str = "Camera:GPSZAccuracy"
5056

5157

5258
class DJITags(XMPTags):
@@ -62,13 +68,19 @@ class DJITags(XMPTags):
6268
CAPTURE_UUID = "drone-dji:CaptureUUID"
6369
DEWARP_FLAG = "drone-dji:DewarpFlag"
6470
DISTORTION = "drone-dji:DewarpData"
71+
X_ACCURACY_M: str = "drone-dji:RtkStdLon"
72+
Y_ACCURACY_M: str = "drone-dji:RtkStdLat"
73+
Z_ACCURACY_M: str = "drone-dji:RtkStdHgt"
6574

6675

6776
class MicaSenseTags(XMPTags):
6877
"""MicaSense XMP Tags."""
6978

7079
CAPTURE_UUID = "MicaSense:CaptureId"
7180
IRRADIANCE = "Camera:Irradiance"
81+
X_ACCURACY_M: str = "Camera:GPSXYAccuracy"
82+
Y_ACCURACY_M: str = "Camera:GPSXYAccuracy"
83+
Z_ACCURACY_M: str = "Camera:GPSZAccuracy"
7284

7385

7486
class ParrotTags(XMPTags):

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[tool.poetry]
22
name = "imgparse"
3-
version = "2.0.8"
3+
version = "2.0.9"
44
description = "Python image-metadata-parser utilities"
55
authors = []
66
include = [

0 commit comments

Comments
 (0)