Skip to content

Commit

Permalink
enables gmx:anchor for otherconstraints
Browse files Browse the repository at this point in the history
improves #839
  • Loading branch information
pvgenuchten committed Nov 1, 2022
1 parent 018c7f8 commit effa03c
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 @@ -494,6 +494,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 effa03c

Please sign in to comment.