Skip to content

Commit 046774f

Browse files
authored
Update to a working CSW example (#228)
1 parent 14c27ba commit 046774f

1 file changed

Lines changed: 22 additions & 24 deletions

File tree

workshop/jupyter/content/notebooks/10-remote-data.ipynb

Lines changed: 22 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -708,7 +708,7 @@
708708
"from owslib.fes import PropertyIsLike, BBox, And, PropertyIsEqualTo\n",
709709
"from owslib.csw import CatalogueServiceWeb\n",
710710
"\n",
711-
"thecsw = CatalogueServiceWeb('http://geoportal.gov.cz/php/micka/csw/index.php')"
711+
"thecsw = CatalogueServiceWeb('https://inspire-geoportal.ec.europa.eu/srv/eng/csw')"
712712
]
713713
},
714714
{
@@ -726,11 +726,10 @@
726726
},
727727
"outputs": [],
728728
"source": [
729-
"# wfs_query = PropertyIsLike('csw:AnyText', 'WFS')\n",
730-
"geology_query = PropertyIsLike('csw:AnyText', 'Geology')\n",
731729
"service_query = PropertyIsLike('apiso:type', 'service')\n",
732-
"geology_and_wfs = And([geology_query, service_query])\n",
733-
"thecsw.getrecords2([geology_and_wfs], esn='full')\n",
730+
"geology_query = PropertyIsLike('csw:AnyText', 'Geology')\n",
731+
"all_queries = And([ service_query, geology_query])\n",
732+
"thecsw.getrecords2([all_queries], esn='full')\n",
734733
"\n",
735734
"print(thecsw.results)"
736735
]
@@ -766,7 +765,7 @@
766765
},
767766
"source": [
768767
"### Step 2 - Get the WFS endpoint and interact with it\n",
769-
"Let's have a look at WFS data from the Czech Geology survey."
768+
"Let's have a look at WFS from the INSPIRE compliant download service, hosted at https://spatial.naturalsciences.be. "
770769
]
771770
},
772771
{
@@ -784,10 +783,11 @@
784783
},
785784
"outputs": [],
786785
"source": [
787-
"geology = thecsw.records['575a4ef6-2f74-43ed-9352-6f400a010852']\n",
788-
"print(f'Abstract: {geology.abstract}')\n",
786+
"boreholes = thecsw.records['aeaeaab2-10ac-48ac-922f-077a831a61c5']\n",
787+
"print(f'Abstract: {boreholes.abstract}')\n",
789788
"\n",
790-
"print(f'Identifier: {geology.identifiers[1][\"identifier\"]}')"
789+
"print(f'Identifier: {boreholes.identifiers[0][\"identifier\"]}')\n",
790+
"print(f'URL: {boreholes.uris[0][\"url\"]}')"
791791
]
792792
},
793793
{
@@ -806,8 +806,7 @@
806806
"outputs": [],
807807
"source": [
808808
"from owslib.wfs import WebFeatureService\n",
809-
"url = 'http://inspire.geology.cz/geoserver/wms?service=WMS&version=1.3.0&request=Getcapabilities'\n",
810-
"geology_wfs = WebFeatureService(geology.identifiers[1]['identifier'])"
809+
"boreholes_wfs = WebFeatureService(boreholes.uris[0][\"url\"])"
811810
]
812811
},
813812
{
@@ -838,13 +837,13 @@
838837
},
839838
"outputs": [],
840839
"source": [
841-
"capabilities = geology_wfs.getcapabilities()\n",
840+
"capabilities = boreholes_wfs.getcapabilities()\n",
842841
"print(f'URL: {capabilities.geturl()}')\n",
843-
"print(f'Name: {geology_wfs.provider.name}')\n",
844-
"print(f'Title: {geology_wfs.identification.title}')\n",
845-
"print(f'Keywords: {geology_wfs.identification.keywords[0]}')\n",
846-
"print(f'Fees: {geology_wfs.identification.fees}')\n",
847-
"print(f'Abstract: {geology_wfs.identification.abstract}')"
842+
"print(f'Name: {boreholes_wfs.provider.name}')\n",
843+
"print(f'Title: {boreholes_wfs.identification.title}')\n",
844+
"print(f'Keywords: {boreholes_wfs.identification.keywords[0]}')\n",
845+
"print(f'Fees: {boreholes_wfs.identification.fees}')\n",
846+
"print(f'Abstract: {boreholes_wfs.identification.abstract}')"
848847
]
849848
},
850849
{
@@ -875,9 +874,8 @@
875874
},
876875
"outputs": [],
877876
"source": [
878-
"for i in geology_wfs.contents:\n",
879-
" print(f'\\n#### {i} ####')\n",
880-
" print(geology_wfs.contents[i].abstract)"
877+
"for i in boreholes_wfs.contents:\n",
878+
" print(f'\\n#### {i} ####')"
881879
]
882880
},
883881
{
@@ -908,10 +906,10 @@
908906
},
909907
"outputs": [],
910908
"source": [
911-
"identifier = 'gsmlp:CZE_CGS_500k_Fault'\n",
912-
"features = geology_wfs.getfeature([identifier])\n",
909+
"identifier = 'ge:boreholes_cores_rbins'\n",
910+
"features = boreholes_wfs.getfeature([identifier])\n",
913911
"\n",
914-
"with open('test/10-geology-faults.gml', 'w', encoding='UTF-8') as out:\n",
912+
"with open('test/10-boreholes.gml', 'w', encoding='UTF-8') as out:\n",
915913
" out.write(str(features.read(), 'UTF-8'))"
916914
]
917915
},
@@ -928,7 +926,7 @@
928926
"tags": []
929927
},
930928
"source": [
931-
"View the GML-data in browser via [this link](test/10-geology-faults.gml).\n",
929+
"View the GML-data in browser via [this link](test/10-boreholes.gml).\n",
932930
"\n",
933931
"---\n",
934932
"[<- Publishing](09-publishing.ipynb) | [Emerging technology and trends ->](11-emerging-technology-trends.ipynb)"

0 commit comments

Comments
 (0)