From 8286b5e50c220d79328b42ff8e8ca5afc647a08a Mon Sep 17 00:00:00 2001 From: jokiefer Date: Wed, 22 Nov 2023 14:40:32 +0100 Subject: [PATCH] Update CHANGELOG.rst, __init__.py, and 2 more files... --- CHANGELOG.rst | 8 ++++++++ ows_lib/__init__.py | 2 +- .../xml_mapper/iso_metadata/iso_metadata.py | 18 ++++++++++++------ tests/test_data/iso_metadata/dataset.xml | 2 +- 4 files changed, 22 insertions(+), 8 deletions(-) diff --git a/CHANGELOG.rst b/CHANGELOG.rst index 5d944ee..3185ae9 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -7,6 +7,14 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +[v0.11.1] - 2023-11-22 +--------------------- + +Fixed +~~~~~ + +* reference system parsing for `gmx:Anchor` elements + [v0.11.1] - 2023-11-22 --------------------- diff --git a/ows_lib/__init__.py b/ows_lib/__init__.py index 79b9e43..8214ceb 100644 --- a/ows_lib/__init__.py +++ b/ows_lib/__init__.py @@ -1,2 +1,2 @@ -__version__ = "0.11.1" +__version__ = "0.11.2" VERSION = __version__ # synonym diff --git a/ows_lib/xml_mapper/iso_metadata/iso_metadata.py b/ows_lib/xml_mapper/iso_metadata/iso_metadata.py index 99af98d..1f2d3dc 100644 --- a/ows_lib/xml_mapper/iso_metadata/iso_metadata.py +++ b/ows_lib/xml_mapper/iso_metadata/iso_metadata.py @@ -102,6 +102,7 @@ class ReferenceSystem(CustomXmlObject, xmlmap.XmlObject): ("gco", GCO_NAMESPACE)]) _ref_system = xmlmap.StringField(xpath="gmd:code/gco:CharacterString") + _gmx_ref_system = xmlmap.StringField(xpath="gmd:code/gmx:Anchor") def __eq__(self, other): return self.code == other.code and self.prefix == other.prefix @@ -112,13 +113,18 @@ def transform_to_model(self) -> Dict: return attr def _parse_ref_system(self): - if "http://www.opengis.net/def/crs/EPSG" in self._ref_system: - code = self._ref_system.split("/")[-1] - prefix = "EPSG" + ref_child = self._ref_system if self._ref_system else self._gmx_ref_system + if ref_child: + if "http://www.opengis.net/def/crs/EPSG" in ref_child: + code = ref_child.split("/")[-1] + prefix = "EPSG" + else: + code = ref_child.split(":")[-1] + prefix = "EPSG" + + return code, prefix else: - code = self._ref_system.split(":")[-1] - prefix = "EPSG" - return code, prefix + return None @property def code(self): diff --git a/tests/test_data/iso_metadata/dataset.xml b/tests/test_data/iso_metadata/dataset.xml index 1d128e8..9edf8da 100644 --- a/tests/test_data/iso_metadata/dataset.xml +++ b/tests/test_data/iso_metadata/dataset.xml @@ -92,7 +92,7 @@ ISO 19115-2 Geographic information — Metadata — Part 2: Extensions for image - http://www.opengis.net/def/crs/EPSG/0/4258 + EPSG:4258