.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "gallery/web_services/wmts_time.py" .. LINE NUMBERS ARE GIVEN BELOW. .. only:: html .. note:: :class: sphx-glr-download-link-note :ref:`Go to the end ` to download the full example code .. rst-class:: sphx-glr-example-title .. _sphx_glr_gallery_web_services_wmts_time.py: Web Map Tile Service time dimension demonstration ------------------------------------------------- This example further demonstrates WMTS support within cartopy. Optional keyword arguments can be supplied to the OGC WMTS 'gettile' method. This allows for the specification of the 'time' dimension for a WMTS layer which supports it. The example shows satellite imagery retrieved from NASA's Global Imagery Browse Services for 5th Feb 2016. A true color MODIS image is shown on the left, with the MODIS false color 'snow RGB' shown on the right. .. GENERATED FROM PYTHON SOURCE LINES 15-56 .. rst-class:: sphx-glr-script-out .. code-block:: pytb Traceback (most recent call last): File "/home/circleci/project/examples/web_services/wmts_time.py", line 55, in main() File "/home/circleci/project/examples/web_services/wmts_time.py", line 25, in main wmts = WebMapTileService(url) ^^^^^^^^^^^^^^^^^^^^^^ File "/home/circleci/.local/lib/python3.11/site-packages/owslib/wmts.py", line 197, in __init__ self._buildMetadata(parse_remote_metadata) File "/home/circleci/.local/lib/python3.11/site-packages/owslib/wmts.py", line 248, in _buildMetadata gather_layers(caps, None) File "/home/circleci/.local/lib/python3.11/site-packages/owslib/wmts.py", line 239, in gather_layers cm = ContentMetadata( ^^^^^^^^^^^^^^^^ File "/home/circleci/.local/lib/python3.11/site-packages/owslib/wmts.py", line 819, in __init__ raise ValueError( ValueError: list of values can not be empty | .. code-block:: Python from matplotlib import patheffects import matplotlib.pyplot as plt from owslib.wmts import WebMapTileService import cartopy.crs as ccrs def main(): # URL of NASA GIBS url = 'https://gibs.earthdata.nasa.gov/wmts/epsg4326/best/wmts.cgi' wmts = WebMapTileService(url) # Layers for MODIS true color and snow RGB layers = ['MODIS_Terra_SurfaceReflectance_Bands143', 'MODIS_Terra_CorrectedReflectance_Bands367'] date_str = '2016-02-05' # Plot setup plot_crs = ccrs.Mercator() geodetic_crs = ccrs.Geodetic() x0, y0 = plot_crs.transform_point(4.6, 43.1, geodetic_crs) x1, y1 = plot_crs.transform_point(11.0, 47.4, geodetic_crs) ysize = 8 xsize = 2 * ysize * (x1 - x0) / (y1 - y0) fig = plt.figure(figsize=(xsize, ysize), dpi=100) for layer, offset in zip(layers, [0, 0.5]): ax = fig.add_axes([offset, 0, 0.5, 1], projection=plot_crs) ax.set_xlim((x0, x1)) ax.set_ylim((y0, y1)) ax.add_wmts(wmts, layer, wmts_kwargs={'time': date_str}) txt = ax.text(4.7, 43.2, wmts[layer].title, fontsize=18, color='wheat', transform=geodetic_crs) txt.set_path_effects([patheffects.withStroke(linewidth=5, foreground='black')]) plt.show() if __name__ == '__main__': main() .. rst-class:: sphx-glr-timing **Total running time of the script:** (0 minutes 0.589 seconds) .. _sphx_glr_download_gallery_web_services_wmts_time.py: .. only:: html .. container:: sphx-glr-footer sphx-glr-footer-example .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: wmts_time.ipynb ` .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: wmts_time.py ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_