diff --git a/imgparse/parser.py b/imgparse/parser.py index a372827..12e7c6b 100644 --- a/imgparse/parser.py +++ b/imgparse/parser.py @@ -602,3 +602,15 @@ def dewarp_flag(self) -> bool: raise ParsingError( "Couldn't parse dewarp flag. Sensor might not be supported" ) + + def gps_accuracy(self) -> tuple[float, float, float]: + """Get the GPS accuracy values in meters for x, y, and z.""" + try: + x_acc = float(self.xmp_data[self.xmp_tags.X_ACCURACY_M]) + y_acc = float(self.xmp_data[self.xmp_tags.Y_ACCURACY_M]) + z_acc = float(self.xmp_data[self.xmp_tags.Z_ACCURACY_M]) + return x_acc, y_acc, z_acc + except KeyError: + raise ParsingError( + "Couldn't parse GPS accuracy. Sensor might not be supported" + ) diff --git a/imgparse/xmp_tags.py b/imgparse/xmp_tags.py index 93aabef..b168d76 100644 --- a/imgparse/xmp_tags.py +++ b/imgparse/xmp_tags.py @@ -29,6 +29,9 @@ class XMPTags: CAPTURE_UUID: str = "" FLIGHT_UUID: str = "" DEWARP_FLAG: str = "" + X_ACCURACY_M: str = "" + Y_ACCURACY_M: str = "" + Z_ACCURACY_M: str = "" class SenteraTags(XMPTags): @@ -47,6 +50,9 @@ class SenteraTags(XMPTags): DISTORTION = "Camera:PerspectiveDistortion" CAPTURE_UUID = "Camera:CaptureUUID" FLIGHT_UUID = "Camera:FlightUUID" + X_ACCURACY_M: str = "Camera:GPSXYAccuracy" + Y_ACCURACY_M: str = "Camera:GPSXYAccuracy" + Z_ACCURACY_M: str = "Camera:GPSZAccuracy" class DJITags(XMPTags): @@ -62,6 +68,9 @@ class DJITags(XMPTags): CAPTURE_UUID = "drone-dji:CaptureUUID" DEWARP_FLAG = "drone-dji:DewarpFlag" DISTORTION = "drone-dji:DewarpData" + X_ACCURACY_M: str = "drone-dji:RtkStdLon" + Y_ACCURACY_M: str = "drone-dji:RtkStdLat" + Z_ACCURACY_M: str = "drone-dji:RtkStdHgt" class MicaSenseTags(XMPTags): @@ -69,6 +78,9 @@ class MicaSenseTags(XMPTags): CAPTURE_UUID = "MicaSense:CaptureId" IRRADIANCE = "Camera:Irradiance" + X_ACCURACY_M: str = "Camera:GPSXYAccuracy" + Y_ACCURACY_M: str = "Camera:GPSXYAccuracy" + Z_ACCURACY_M: str = "Camera:GPSZAccuracy" class ParrotTags(XMPTags): diff --git a/pyproject.toml b/pyproject.toml index 73c20d7..262fede 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "imgparse" -version = "2.0.8" +version = "2.0.9" description = "Python image-metadata-parser utilities" authors = [] include = [