Interactive WMTS (Web Map Tile Service)#

This example demonstrates the interactive pan and zoom capability supported by an OGC web services Web Map Tile Service (WMTS) aware axes.

The example WMTS layer is a single composite of data sampled over nine days in April 2012 and thirteen days in October 2012 showing the Earth at night. It does not vary over time.

The imagery was collected by the Suomi National Polar-orbiting Partnership (Suomi NPP) weather satellite operated by the United States National Oceanic and Atmospheric Administration (NOAA).

Suomi NPP Earth at night April/October 2012
/home/circleci/.local/lib/python3.11/site-packages/owslib/wmts.py:856: FutureWarning: The behavior of this method will change in future versions. Use specific 'len(elem)' or 'elem is not None' test instead.
  if current and current.text == 'true':
/home/circleci/.local/lib/python3.11/site-packages/owslib/wmts.py:653: RuntimeWarning: TileMatrixLimits with tileMatrix "1" already exists
  warnings.warn(msg, RuntimeWarning)
/home/circleci/.local/lib/python3.11/site-packages/owslib/wmts.py:653: RuntimeWarning: TileMatrixLimits with tileMatrix "2" already exists
  warnings.warn(msg, RuntimeWarning)
/home/circleci/.local/lib/python3.11/site-packages/owslib/wmts.py:653: RuntimeWarning: TileMatrixLimits with tileMatrix "3" already exists
  warnings.warn(msg, RuntimeWarning)
/home/circleci/.local/lib/python3.11/site-packages/owslib/wmts.py:653: RuntimeWarning: TileMatrixLimits with tileMatrix "4" already exists
  warnings.warn(msg, RuntimeWarning)
/home/circleci/.local/lib/python3.11/site-packages/owslib/wmts.py:653: RuntimeWarning: TileMatrixLimits with tileMatrix "5" already exists
  warnings.warn(msg, RuntimeWarning)
/home/circleci/.local/lib/python3.11/site-packages/owslib/wmts.py:653: RuntimeWarning: TileMatrixLimits with tileMatrix "6" already exists
  warnings.warn(msg, RuntimeWarning)

import matplotlib.pyplot as plt

import cartopy.crs as ccrs


def main():
    url = 'https://map1c.vis.earthdata.nasa.gov/wmts-geo/wmts.cgi'
    layer = 'VIIRS_CityLights_2012'

    fig = plt.figure()
    ax = fig.add_subplot(1, 1, 1, projection=ccrs.PlateCarree())
    ax.add_wmts(url, layer)
    ax.set_extent([-15, 25, 35, 60], crs=ccrs.PlateCarree())

    ax.set_title('Suomi NPP Earth at night April/October 2012')
    plt.show()


if __name__ == '__main__':
    main()

Total running time of the script: (0 minutes 1.274 seconds)

Gallery generated by Sphinx-Gallery