Skip to content

Instantly share code, notes, and snippets.

@gannebamm
Created August 23, 2022 13:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gannebamm/5ad7dec84e52f5c33c7654422278268d to your computer and use it in GitHub Desktop.
Save gannebamm/5ad7dec84e52f5c33c7654422278268d to your computer and use it in GitHub Desktop.
Very basic example of the CSW API usage for https://atlas.thuenen.de
from owslib.csw import CatalogueServiceWeb
from owslib.fes import PropertyIsEqualTo, PropertyIsLike, BBox
# variables
csw_endpoint = 'https://atlas.thuenen.de/catalogue/csw'
search_text = 'agraratlas'
# connect to csw
csw = CatalogueServiceWeb(csw_endpoint)
# 1. query by search string
text_query = PropertyIsEqualTo('csw:AnyText', search_text)
csw.getrecords2(constraints=[text_query], maxrecords=20)
# print response titles
for rec in csw.records:
print(csw.records[rec].title)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment