OWSLib
OWSLib copied to clipboard
adding check for gmx:Anchor
- make sure
accessconstraints
,useconstraints
andidentifier
values are picked when available asgmx:Anchor
instead ofgco:CharacterString
- extend
resourcelanguage
, MI_Instrument
Some background info:
https://www.ngdc.noaa.gov/wiki/index.php/Character_String_Extended_Types - """ With the gmx namespace added, gmx:Anchor is a valid substitute for any gco:CharacterString in the ISO XML"""
suggestion it to add a function for extracting characterstring|anchor, with doc and xpath to parent element as input
unit test should be able to extract (link and) string or nill from
either
element does not exist
or empty
<xxx gco:nilReason="missing">
<gco:CharacterString/></xxx>
or CharacterString
<xxx>
<gco:CharacterString>Nederlands metadata profiel op ISO 19119 voor services 2.1.0</gco:CharacterString>
</xxx>
or Anchor
<xxx>
<gmx:Anchor xlink:href="http://www.opengis.net/def/crs/EPSG/0/28992">Rijks Driehoeksstelsel</gmx:Anchor>
</xxx>
or filename
<xxx>
<gmx:FileName src="http://www.nosa.noaa.gov/image/global/LgFLUXNET.jpg">Browse Graphic for FluxNet</gmx:FileName>
</xxx>
Another case to manage would be if the metadata is multilingual
<xxx xsi:type="gmd:PT_FreeText_PropertyType">
<gco:CharacterString>Copy of template Template for Vector data in ISO19139 (multilingual) created at 2021-11-03T13:06:09Z</gco:CharacterString>
<gmd:PT_FreeText>
<gmd:textGroup>
<gmd:LocalisedCharacterString locale="#EN">Copy of template Template for Vector data in ISO19139 (multilingual) created at 2021-11-03T13:06:09Z</gmd:LocalisedCharacterString>
</gmd:textGroup>
<gmd:textGroup>
<gmd:LocalisedCharacterString locale="#FR">Copy of template Modèle de données vectorielles en ISO19139 (multilingue) created at 2021-11-03T13:06:09Z</gmd:LocalisedCharacterString>
</gmd:textGroup>
</gmd:PT_FreeText>
</xxx>
+1/agree with @huard to add a couple of unit tests to test functionality between gco:CharacterString
and gmx:Anchor
.
What would be even better is a local utility function which can detect one or the other, and be reused across those ISO elements which support either.
Working on this issue this week. Thanks for the comments!
Hi, it looks like a good start, thanx!
Interesting aspect of using an anchor is that it typically does not return a string, but a combination of xlink:href and string (or either one).
the owslib model may not be ready to capture {label:example,link:foo}, alternative could be to store it as [ label ]( href )
(markdown style)