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

consider a getrecordbyid response wrapper when trying to import iso19139 #854

Open
pvgenuchten opened this issue Dec 13, 2022 · 2 comments

Comments

@pvgenuchten
Copy link
Contributor

pvgenuchten commented Dec 13, 2022

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
@kalxas
Copy link
Member

kalxas commented Feb 16, 2023

Thanks @pvgenuchten for the comment/proposal, adding it to the enhancement list

@kalxas kalxas added the csw label Feb 16, 2023
Copy link

github-actions bot commented Oct 6, 2024

This Issue has been inactive for 90 days. In order to manage maintenance burden, it will be automatically closed in 7 days.

@github-actions github-actions bot added the stale label Oct 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants