From f7d58d863f886e8403871406fd2ca15d6b9a0b69 Mon Sep 17 00:00:00 2001 From: Joseph Franck Date: Tue, 17 Feb 2026 16:05:58 -0600 Subject: [PATCH 1/2] new function for getting image gps accuracy --- imgparse/parser.py | 12 ++++++++++++ imgparse/xmp_tags.py | 9 +++++++++ pyproject.toml | 2 +- 3 files changed, 22 insertions(+), 1 deletion(-) 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..62f3af7 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): 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 = [ From 10de33df06e11a2142ee9b84250d934f45b8d236 Mon Sep 17 00:00:00 2001 From: Joseph Franck Date: Thu, 19 Feb 2026 12:16:52 -0600 Subject: [PATCH 2/2] add for micasense too --- imgparse/xmp_tags.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/imgparse/xmp_tags.py b/imgparse/xmp_tags.py index 62f3af7..b168d76 100644 --- a/imgparse/xmp_tags.py +++ b/imgparse/xmp_tags.py @@ -78,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):