| 1 |
|
| 2 |
Imports |
| 3 |
|
| 4 |
>>> from tests.utils import scratch_file |
| 5 |
|
| 6 |
Find out what a WMTS has to offer. Service metadata: |
| 7 |
|
| 8 |
>>> from owslib.wmts import WebMapTileService |
| 9 |
>>> wmts = WebMapTileService("http://map1c.vis.earthdata.nasa.gov/wmts-geo/wmts.cgi") |
| 10 |
>>> wmts.identification.type |
| 11 |
'OGC WMTS' |
| 12 |
>>> wmts.identification.version |
| 13 |
'1.0.0' |
| 14 |
>>> wmts.identification.title |
| 15 |
'NASA Global Imagery Browse Services for EOSDIS' |
| 16 |
>>> bytearray(wmts.identification.abstract, 'utf-8') |
| 17 |
bytearray(b'Near real time imagery from multiple NASA instruments') |
| 18 |
>>> wmts.identification.keywords |
| 19 |
['World', 'Global'] |
| 20 |
|
| 21 |
Service Provider: |
| 22 |
|
| 23 |
>>> wmts.provider.name |
| 24 |
'National Aeronautics and Space Administration' |
| 25 |
|
| 26 |
>>> wmts.provider.url |
| 27 |
'https://earthdata.nasa.gov/' |
| 28 |
|
| 29 |
Available Layers: |
| 30 |
|
| 31 |
>>> len(wmts.contents.keys()) > 0 |
| 32 |
True |
| 33 |
>>> sorted(list(wmts.contents))[0] |
| 34 |
'AIRS_CO_Total_Column_Day' |
| 35 |
|
| 36 |
Fetch a tile (using some defaults): |
| 37 |
|
| 38 |
>>> tile = wmts.gettile(layer='MODIS_Terra_CorrectedReflectance_TrueColor', tilematrixset='EPSG4326_250m', tilematrix='0', row=0, column=0, format="image/jpeg") |
| 39 |
>>> out = open(scratch_file('nasa_modis_terra_truecolour.jpg'), 'wb') |
| 40 |
>>> bytes_written = out.write(tile.read()) |
| 41 |
>>> out.close() |
| 42 |
|
| 43 |
Test styles for several layers |
| 44 |
>>> wmts.contents['MLS_SO2_147hPa_Night'].styles |
| 45 |
{'default': {'isDefault': True, 'title': 'default'}} |
| 46 |
>>> wmts.contents['MLS_SO2_147hPa_Night'].styles |
| 47 |
{'default': {'isDefault': True, 'title': 'default'}} |
| 48 |
|
| 49 |
Test a WMTS without a ServiceProvider tag in Capababilities XML |
| 50 |
|
| 51 |
>>> wmts = WebMapTileService('http://data.geus.dk/arcgis/rest/services/OneGeologyGlobal/S071_G2500_OneGeology/MapServer/WMTS/1.0.0/WMTSCapabilities.xml') |
| 52 |
|