Open pvgenuchten opened 1 year ago
when querying a CSW record by id like https://geoportal.icpac.net/catalogue/csw?service=CSW&version=2.0.2&request=GetRecordById&outputschema=http://www.isotc211.org/2005/gmd&elementsetname=full&id=de811536-eaf8-11ec-80b2-0242ac170007, csw responds with an iso document wrapped in a getrecordbyid response object
owslib fails to parse the wrapped record
does it make sense to enable owslib to identify if a wrapper is used, and if so, fetch the internal metadata object and parse it?
resp = req.get('https://geoportal.icpac.net/catalogue/csw?service=CSW&version=2.0.2&request=GetRecordById&outputschema=http://www.isotc211.org/2005/gmd&elementsetname=full&id=87c0b1e2-b0cf-11ec-890e-0242ac160007') doc = etree.XML(resp.text) nsmap = {} for ns in doc.xpath('//namespace::*'): if ns[0]: nsmap[ns[0]] = ns[1] md = m.xpath('gmd:MD_Metadata', namespaces=nsmap) m2 = MD_Metadata(md[0])
Or could i better use the embedded csw cient
from owslib.csw import CatalogueServiceWeb csw = CatalogueServiceWeb('https://geoportal.icpac.net/catalogue/csw') csw.getrecordbyid(id=['de811536-eaf8-11ec-80b2-0242ac17000'])
For pyCSW consider to use getrepositoryitem to fetch the inner xml document
https://geoportal.icpac.net/catalogue/csw?service=CSW&version=2.0.2&request=GetRepositoryItem&outputschema=http://www.isotc211.org/2005/gmd&elementsetname=full&id=de811536-eaf8-11ec-80b2-0242ac170007
Thanks @pvgenuchten for the comment/proposal, adding it to the enhancement list
when querying a CSW record by id like https://geoportal.icpac.net/catalogue/csw?service=CSW&version=2.0.2&request=GetRecordById&outputschema=http://www.isotc211.org/2005/gmd&elementsetname=full&id=de811536-eaf8-11ec-80b2-0242ac170007, csw responds with an iso document wrapped in a getrecordbyid response object
owslib fails to parse the wrapped record
does it make sense to enable owslib to identify if a wrapper is used, and if so, fetch the internal metadata object and parse it?
Or could i better use the embedded csw cient
For pyCSW consider to use getrepositoryitem to fetch the inner xml document