OWSLib icon indicating copy to clipboard operation
OWSLib copied to clipboard

adding check for gmx:Anchor

Open epifanio opened this issue 3 years ago • 4 comments

  • make sure accessconstraints, useconstraints and identifier values are picked when available as gmx:Anchor instead of gco: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"""

epifanio avatar Nov 02 '21 17:11 epifanio

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>

pvgenuchten avatar Nov 03 '21 13:11 pvgenuchten

+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.

tomkralidis avatar Nov 05 '21 22:11 tomkralidis

Working on this issue this week. Thanks for the comments!

epifanio avatar Dec 06 '21 12:12 epifanio

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)

pvgenuchten avatar May 25 '22 20:05 pvgenuchten