Skip to content

Commit

Permalink
Update CHANGELOG.rst, __init__.py, and 2 more files...
Browse files Browse the repository at this point in the history
  • Loading branch information
jokiefer committed Nov 22, 2023
1 parent d7a95de commit 8286b5e
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 8 deletions.
8 changes: 8 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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
---------------------
Expand Down
2 changes: 1 addition & 1 deletion ows_lib/__init__.py
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
__version__ = "0.11.1"
__version__ = "0.11.2"
VERSION = __version__ # synonym
18 changes: 12 additions & 6 deletions ows_lib/xml_mapper/iso_metadata/iso_metadata.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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):
Expand Down
2 changes: 1 addition & 1 deletion tests/test_data/iso_metadata/dataset.xml
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ ISO 19115-2 Geographic information — Metadata — Part 2: Extensions for image
<gmd:referenceSystemIdentifier>
<gmd:RS_Identifier>
<gmd:code>
<gco:CharacterString>http://www.opengis.net/def/crs/EPSG/0/4258</gco:CharacterString>
<gmx:Anchor xlink:href="http://www.opengis.net/def/crs/EPSG/0/4258">EPSG:4258</gmx:Anchor>
</gmd:code>
</gmd:RS_Identifier>
</gmd:referenceSystemIdentifier>
Expand Down

0 comments on commit 8286b5e

Please sign in to comment.