Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for ISO 19115 Part 3 XML #900

Merged
merged 17 commits into from
Mar 23, 2024

Conversation

vjf
Copy link
Contributor

@vjf vjf commented Jan 8, 2024

This pull request enables OWSLib to parse ISO 19115 Part 3 XML output.
e.g. parse Metadata URL output in GetCapabilities responses and parse CSW GetRecords repsonses

Also fixed bugs in metadataURL tests. (tests/test_remote_metadata.py) The patch code for 'openURL' was not being called, 'Offline' tests were still calling on live external services.

Once this PR has been merged and a new version of OWSLib is built, geopython/pycsw#933 can be updated and merged

vjf added 15 commits January 2, 2024 11:58
- Added ArcGIS synthetic sample
- Added tests for DQ_DataQuality, MD_FeatureCatalogueDescription and MD_Bands
- Ability to parse older mdb v1.0 XML
- Some 'Offline' tests were still calling on external services, monkeypatch of 'OpenURL' not working
- Fixed up monkeypatch of 'OpenURL' calls
- Added function to detect outer tag for iso_3.py
- Added code to utilise iso_3 in WFS/WMS GetCapabilities responses
- Added ISO 19115 Part 3 XML tests using pytest parameters
@coveralls
Copy link

coveralls commented Jan 8, 2024

Coverage Status

coverage: 60.786% (+1.2%) from 59.578%
when pulling 4cb7cb5 on vjf:ISO19115-3-part1
into bdc4033 on geopython:master.

tests/test_iso3_parsing.py Outdated Show resolved Hide resolved
@kalxas
Copy link
Member

kalxas commented Feb 26, 2024

Thank you @vjf for this valuable contribution!

owslib/catalogue/csw2.py Outdated Show resolved Hide resolved
@@ -578,6 +580,12 @@ def _parserecords(self, outputschema, esn):
val = i.find(util.nspath_eval('gm03:fileIdentifier', namespaces))
identifier = self._setidentifierkey(util.testXMLValue(val))
self.records[identifier] = GM03(i)
elif MD_Metadata_3.handles(outputschema): # ISO 19115 Part 3 XML
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we follow the same pattern (check for root namespace)?

Copy link
Contributor Author

@vjf vjf Mar 22, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It does check the root namespace, only I have put this function inside the class.
For ISO19115p3, in order to support both ESRI and geoserver, unlike all the other schema types there are two versions of the set of namespaces.
Rather than add more complicated code to csw2.py, csw3.py etc., I decided that the best place for this detection logic was inside the class.
I thought it would be more portable and maintainable to have it in there rather than outside the class.

@@ -477,6 +479,12 @@ def _parserecords(self, outputschema, esn):
val = i.find(util.nspath_eval('gm03:fileIdentifier', namespaces))
identifier = self._setidentifierkey(util.testXMLValue(val))
self.records[identifier] = GM03(i)
elif MD_Metadata_3.handles(outputschema): # ISO 19115 Part 3 XML
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same comment here.

@@ -470,7 +471,11 @@ def parse_remote_metadata(self, timeout=30):
if mdelem is not None:
metadataUrl["metadata"] = MD_Metadata(mdelem)
else:
metadataUrl["metadata"] = None
mdelem = MD_Metadata_3.find_start(doc)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we check the root namespace here to decipher between the two ISO versions?

owslib/iso_3.py Outdated
"xlink":"http://www.w3.org/1999/xlink"
}

class printable():
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this function required?

@tomkralidis tomkralidis merged commit cdcfce7 into geopython:master Mar 23, 2024
5 checks passed
@tomkralidis
Copy link
Member

Thanks @vjf for this valuable contribution!

@vjf
Copy link
Contributor Author

vjf commented Mar 24, 2024

@tomkralidis @kalxas Thanks!

@vjf vjf deleted the ISO19115-3-part1 branch March 24, 2024 23:42
@jmckenna
Copy link
Member

seconded, thank-you @vjf !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants