
Imports

    >>> from __future__ import (absolute_import, division, print_function)
    >>> from tests.utils import scratch_file

Find out what a WMTS has to offer. Service metadata:

    >>> from owslib.wmts import WebMapTileService
    >>> wmts = WebMapTileService("http://map1c.vis.earthdata.nasa.gov/wmts-geo/wmts.cgi")
    >>> wmts.identification.type
    'OGC WMTS'
    >>> wmts.identification.version
    '1.0.0'
    >>> wmts.identification.title
    'NASA Global Imagery Browse Services for EOSDIS'
    >>> bytearray(wmts.identification.abstract, 'utf-8')
    bytearray(b'The Global Imagery Browse Services (GIBS) system is a core EOSDIS component which provides a scalable, responsive, highly available, and community standards based set of imagery services.  These services are designed with the goal of advancing user interactions with EOSDIS\xe2\x80\x99 inter-disciplinary data through enhanced visual representation and discovery.')
    >>> wmts.identification.keywords
    ['World', 'Global']

Service Provider:

    >>> wmts.provider.name
    'National Aeronautics and Space Administration'

    >>> wmts.provider.url
    'http://earthdata.nasa.gov/'
    
Available Layers:

    >>> len(wmts.contents.keys()) > 0
    True
    >>> sorted(list(wmts.contents))[0]
    'AIRS_CO_Total_Column_Day'

Fetch a tile (using some defaults):

    >>> tile = wmts.gettile(layer='MODIS_Terra_CorrectedReflectance_TrueColor', tilematrixset='EPSG4326_250m', tilematrix='0', row=0, column=0, format="image/jpeg")
    >>> out = open(scratch_file('nasa_modis_terra_truecolour.jpg'), 'wb')
    >>> bytes_written = out.write(tile.read())
    >>> out.close()

Test a WMTS without a ServiceProvider tag in Capababilities XML

    >>> wmts = WebMapTileService('http://data.geus.dk/arcgis/rest/services/OneGeologyGlobal/S071_G2500_OneGeology/MapServer/WMTS/1.0.0/WMTSCapabilities.xml')
