备注
Go to the end 下载完整的示例代码。
交互式GMS(网络地图服务)#
此示例演示了OGC Web服务Web地图服务(GMS)感知轴支持的交互式平移和缩放功能。
Traceback (most recent call last):
File "/pb1/repo/cartopy/examples/web_services/wms.py", line 26, in <module>
main()
~~~~^^
File "/pb1/repo/cartopy/examples/web_services/wms.py", line 19, in main
ax.add_wms(wms='http://vmap0.tiles.osgeo.org/wms/vmap0',
~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
layers=['basic'])
^^^^^^^^^^^^^^^^^
File "/xpy/lib/python3.13/site-packages/cartopy/mpl/geoaxes.py", line 2295, in add_wms
wms = WMSRasterSource(wms, layers, getmap_extra_kwargs=wms_kwargs)
File "/xpy/lib/python3.13/site-packages/cartopy/io/ogc_clients.py", line 225, in __init__
service = WebMapService(service)
File "/xpy/lib/python3.13/site-packages/owslib/wms.py", line 50, in WebMapService
return wms111.WebMapService_1_1_1(
~~~~~~~~~~~~~~~~~~~~~~~~~~^
clean_url, version=version, xml=xml, parse_remote_metadata=parse_remote_metadata,
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
timeout=timeout, headers=headers, auth=auth)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/xpy/lib/python3.13/site-packages/owslib/map/wms111.py", line 75, in __init__
self._capabilities = reader.read(self.url, timeout=self.timeout)
~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/xpy/lib/python3.13/site-packages/owslib/map/common.py", line 65, in read
u = openURL(spliturl[0], spliturl[1], method='Get',
timeout=timeout, headers=self.headers, auth=self.auth)
File "/xpy/lib/python3.13/site-packages/owslib/util.py", line 213, in openURL
req.raise_for_status()
~~~~~~~~~~~~~~~~~~~~^^
File "/xpy/lib/python3.13/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 1.245 seconds)
Gallery generated by Sphinx-Gallery
_