Navigation Menu

Skip to content

Commit

Permalink
fix WMTS parsing when ServiceProvider does not exist
Browse files Browse the repository at this point in the history
  • Loading branch information
tomkralidis committed Feb 18, 2016
1 parent 20fbba7 commit d2d7c60
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
3 changes: 2 additions & 1 deletion owslib/wmts.py
Expand Up @@ -196,7 +196,8 @@ def _buildMetadata(self, parse_remote_metadata=False):

# serviceProvider metadata
serviceprov = self._capabilities.find(_SERVICE_PROVIDER_TAG)
self.provider = ServiceProvider(serviceprov)
if serviceprov is not None:
self.provider = ServiceProvider(serviceprov)

# serviceOperations metadata
self.operations = []
Expand Down
11 changes: 7 additions & 4 deletions tests/doctests/wmts.txt
Expand Up @@ -36,8 +36,11 @@ Available Layers:

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()
>>> 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')

0 comments on commit d2d7c60

Please sign in to comment.