Skip to content

Commit

Permalink
Merge pull request geopython#844 from pvgenuchten/iso19139-otherconst…
Browse files Browse the repository at this point in the history
…raint-as-anchor

enables gmx:anchor for otherconstraints
  • Loading branch information
geographika authored Oct 19, 2024
2 parents a713c62 + effa03c commit d817969
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 3 deletions.
9 changes: 9 additions & 0 deletions owslib/iso.py
Original file line number Diff line number Diff line change
Expand Up @@ -502,6 +502,15 @@ def __init__(self, md=None, identtype=None):
val = util.testXMLValue(i)
if val is not None:
self.otherconstraints.append(val)
for i in md.findall(util.nspath_eval(
'gmd:resourceConstraints/gmd:MD_LegalConstraints/gmd:otherConstraints/gmx:Anchor',
namespaces)):
val = util.testXMLAttribute(i, util.nspath('href', namespaces["xlink"]))
if val is None:
val = util.testXMLValue(i)
if val is not None:
self.otherconstraints.append(val)


self.securityconstraints = []
for i in md.findall(util.nspath_eval(
Expand Down
6 changes: 4 additions & 2 deletions tests/resources/csw_dov_getrecordbyid.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<csw:GetRecordByIdResponse xmlns:csw="http://www.opengis.net/cat/csw/2.0.2">
<gmd:MD_Metadata xmlns:gmd="http://www.isotc211.org/2005/gmd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:gco="http://www.isotc211.org/2005/gco" xmlns:gml="http://www.opengis.net/gml" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:geonet="http://www.fao.org/geonetwork" xsi:schemaLocation="http://www.isotc211.org/2005/gmd http://www.isotc211.org/2005/gmd/gmd.xsd">
<gmd:MD_Metadata xmlns:gmd="http://www.isotc211.org/2005/gmd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:gco="http://www.isotc211.org/2005/gco" xmlns:gmx="http://www.isotc211.org/2005/gmx" xmlns:gml="http://www.opengis.net/gml" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:geonet="http://www.fao.org/geonetwork" xsi:schemaLocation="http://www.isotc211.org/2005/gmd http://www.isotc211.org/2005/gmd/gmd.xsd">
<gmd:fileIdentifier>
<gco:CharacterString>6c39d716-aecc-4fbc-bac8-4f05a49a78d5</gco:CharacterString>
</gmd:fileIdentifier>
Expand Down Expand Up @@ -470,6 +470,9 @@
<gmd:otherConstraints>
<gco:CharacterString>Data beschikbaar voor hergebruik volgens de Modellicentie Gratis Hergebruik. Toelichting beschikbaar op https://www.dov.vlaanderen.be/page/gebruiksvoorwaarden-dov-services</gco:CharacterString>
</gmd:otherConstraints>
<gmd:otherConstraints>
<gmx:Anchor xlink:href="https://inspire.ec.europa.eu/metadata-codelist/ConditionsApplyingToAccessAndUse/noConditionsApply">Geen beperkingen</gmx:Anchor>
</gmd:otherConstraints>
</gmd:MD_LegalConstraints>
</gmd:resourceConstraints>
<gmd:resourceConstraints>
Expand Down Expand Up @@ -841,4 +844,3 @@
</gmd:dataQualityInfo>
</gmd:MD_Metadata>
</csw:GetRecordByIdResponse>

4 changes: 3 additions & 1 deletion tests/test_iso_parsing.py
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,9 @@ def test_md_parsing_dov():

assert_list(iden.classification, 0)

assert_list(iden.otherconstraints, 1)
assert_list(iden.otherconstraints, 2)
assert iden.otherconstraints[
1] == "https://inspire.ec.europa.eu/metadata-codelist/ConditionsApplyingToAccessAndUse/noConditionsApply"
assert iden.otherconstraints[
0] == "Data beschikbaar voor hergebruik volgens de " \
"Modellicentie Gratis Hergebruik. Toelichting " \
Expand Down

0 comments on commit d817969

Please sign in to comment.