Last active
October 5, 2020 14:16
-
-
Save stijnvanhoey/5eb080605d569e4a06b1a8fb0a5ab4aa to your computer and use it in GitHub Desktop.
Examples on how to add OGC WMS and WMTS services to cartopy
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# I use Mercator here as I saw only mercator is supported by the webservice (see website Michel Stuyts or getcapabilities call) | |
plain_crs = ccrs.Mercator() | |
fig, ax = plt.subplots(subplot_kw={"projection": plain_crs}, figsize=(10, 10)) | |
ax.set_extent([2.4, 8, 48., 52], crs=ccrs.PlateCarree()) | |
# Add WMS imaging. | |
base_uri = 'https://image.discomap.eea.europa.eu/arcgis/services/Elevation/EUElev_DEM_V11/MapServer/WMSServer' | |
layer_name = 'DEM_v11_Masked2' | |
ax.add_wms(base_uri, layers=layer_name) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# My main resource to look for services is the website from Michel Stuyts: https://wms.michelstuyts.be/?lang=en | |
# Orthophoto WMS (National Geographic Institute) | |
# WMS: https://wms.ngi.be/inspire/ortho/service | |
# GetCapabilities: https://wms.ngi.be/inspire/ortho/service?REQUEST=GetCapabilities&SERVICE=WMS | |
base_uri = 'https://wms.ngi.be/inspire/ortho/service' | |
# Available layers: | |
# - orthoimage_coverage: Orthoimage coverage | |
# - orthoimage_coverage_2016: Orthoimage coverage - 2016 | |
# - orthoimage_coverage_2018: Orthoimage coverage - 2018 | |
``` | |
layer_name = 'orthoimage_coverage' | |
plain_crs = ccrs.Mercator() | |
fig, ax = plt.subplots(subplot_kw={"projection": plain_crs}, figsize=(10, 10)) | |
ax.set_extent([3.5, 3.75, 50.8, 50.9], crs=ccrs.PlateCarree()) | |
# Add WMS imaging. | |
ax.add_wms(base_uri, layers=layer_name) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# My main resource to look for services is the website from Michel Stuyts: https://wmts.michelstuyts.be/?lang=en | |
# For example a layer from waterinfo.be website (sensitive areas for inundation) | |
# https://inspirepub.waterinfo.be/arcgis/rest/services/overstroombaargebied/MapServer/WMTS/1.0.0/WMTSCapabilities.xml | |
# has the available layer `overstroombaargebied: overstroombaargebied` | |
base_uri = 'https://inspirepub.waterinfo.be/arcgis/rest/services/archief/Overstromingsgevoelige_gebieden_2006/MapServer/WMTS' | |
layer_name = 'archief_Overstromingsgevoelige_gebieden_2006' | |
# I use Mercator here as I saw only mercator is supported by the webservice (see website Michel Stuyts or getcapabilities call) | |
plain_crs = ccrs.Mercator() | |
fig, ax = plt.subplots(subplot_kw={"projection": plain_crs}, figsize=(10, 10)) | |
ax.set_extent([3.5, 3.75, 50.8, 50.9], crs=ccrs.PlateCarree()) | |
# Add WMTS imaging. | |
ax.add_wmts(base_uri, layer_name=layer_name) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment