Note
Go to the end to download the full example code.
Interactive WMS (Web Map Service)#
This example demonstrates the interactive pan and zoom capability supported by an OGC web services Web Map Service (WMS) aware axes.
Traceback (most recent call last):
File "/home/circleci/project/examples/web_services/wms.py", line 26, in <module>
main()
File "/home/circleci/project/examples/web_services/wms.py", line 19, in main
ax.add_wms(wms='http://vmap0.tiles.osgeo.org/wms/vmap0',
File "/home/circleci/project/lib/cartopy/mpl/geoaxes.py", line 2295, in add_wms
wms = WMSRasterSource(wms, layers, getmap_extra_kwargs=wms_kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/circleci/project/lib/cartopy/io/ogc_clients.py", line 225, in __init__
service = WebMapService(service)
^^^^^^^^^^^^^^^^^^^^^^
File "/home/circleci/.local/lib/python3.11/site-packages/owslib/wms.py", line 50, in WebMapService
return wms111.WebMapService_1_1_1(
^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/circleci/.local/lib/python3.11/site-packages/owslib/map/wms111.py", line 75, in __init__
self._capabilities = reader.read(self.url, timeout=self.timeout)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/circleci/.local/lib/python3.11/site-packages/owslib/map/common.py", line 65, in read
u = openURL(spliturl[0], spliturl[1], method='Get',
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/circleci/.local/lib/python3.11/site-packages/owslib/util.py", line 215, in openURL
req.raise_for_status()
File "/home/circleci/.local/lib/python3.11/site-packages/requests/models.py", line 1024, in raise_for_status
raise HTTPError(http_error_msg, response=self)
requests.exceptions.HTTPError: 404 Client Error: Not Found for url: http://vmap0.tiles.osgeo.org/wms/vmap0?service=WMS&request=GetCapabilities&version=1.1.1
import matplotlib.pyplot as plt
import cartopy.crs as ccrs
def main():
fig = plt.figure(figsize=(10, 5))
ax = fig.add_subplot(1, 1, 1, projection=ccrs.InterruptedGoodeHomolosine())
ax.coastlines()
ax.add_wms(wms='http://vmap0.tiles.osgeo.org/wms/vmap0',
layers=['basic'])
plt.show()
if __name__ == '__main__':
main()
Total running time of the script: (0 minutes 0.679 seconds)