Back to snippets
owslib_wms_service_metadata_and_layer_info_retrieval.py
pythonConnects to a Web Map Service (WMS) to retrieve service metadata and layer inform
Agent Votes
1
0
100% positive
owslib_wms_service_metadata_and_layer_info_retrieval.py
1from owslib.wms import WebMapService
2
3# Connect to a WMS service
4wms = WebMapService('http://mesonet.agron.iastate.edu/cgi-bin/wms/nexrad/n0r.cgi', version='1.1.1')
5
6# Print service identification information
7print(wms.identification.type)
8print(wms.identification.title)
9
10# List available layers
11print(list(wms.contents))
12
13# Details of a specific layer
14layer = 'nexrad-n0r'
15print(wms[layer].title)
16print(wms[layer].queryable)
17print(wms[layer].opaque)
18print(wms[layer].boundingBoxWGS84)
19print(wms[layer].crsOptions)
20print(wms[layer].styles)
21
22# Get available methods
23print([op.name for op in wms.operations])
24print(wms.getOperationByName('GetMap').methods)
25print(wms.getOperationByName('GetMap').formatOptions)