Skip to content

Commit

Permalink
Merge pull request #769 from CovingtonResearchGroup/master
Browse files Browse the repository at this point in the history
changed all 'already exists' errors to warnings
  • Loading branch information
geographika authored Oct 7, 2024
2 parents b9cd08b + 5c67b73 commit 4138261
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions owslib/wmts.py
Original file line number Diff line number Diff line change
Expand Up @@ -241,8 +241,9 @@ def gather_layers(parent_elem, parent_metadata):
parse_remote_metadata=parse_remote_metadata)
if cm.id:
if cm.id in self.contents:
raise KeyError('Content metadata for layer "%s" '
msg=('Content metadata for layer "%s" '
'already exists' % cm.id)
warnings.warn(msg, RuntimeWarning)
self.contents[cm.id] = cm
gather_layers(elem, cm)
gather_layers(caps, None)
Expand All @@ -252,17 +253,19 @@ def gather_layers(parent_elem, parent_metadata):
tms = TileMatrixSet(elem)
if tms.identifier:
if tms.identifier in self.tilematrixsets:
raise KeyError('TileMatrixSet with identifier "%s" '
msg = ('TileMatrixSet with identifier "%s" '
'already exists' % tms.identifier)
warnings.warn(msg, RuntimeWarning)
self.tilematrixsets[tms.identifier] = tms

self.themes = {}
for elem in self._capabilities.findall(_THEMES_TAG + '/' + _THEME_TAG):
theme = Theme(elem)
if theme.identifier:
if theme.identifier in self.themes:
raise KeyError('Theme with identifier "%s" already exists'
msg=('Theme with identifier "%s" already exists'
% theme.identifier)
warnings.warn(msg, RuntimeWarning)
self.themes[theme.identifier] = theme

serviceMetadataURL = self._capabilities.find(_SERVICE_METADATA_URL_TAG)
Expand Down Expand Up @@ -519,8 +522,9 @@ def __init__(self, elem):
tm = TileMatrix(tilematrix)
if tm.identifier:
if tm.identifier in self.tilematrix:
raise KeyError('TileMatrix with identifier "%s" '
msg = ('TileMatrix with identifier "%s" '
'already exists' % tm.identifier)
warnings.warn(msg, RuntimeWarning)
self.tilematrix[tm.identifier] = tm


Expand Down Expand Up @@ -748,9 +752,10 @@ def __init__(self, elem, parent=None, index=0, parse_remote_metadata=False):
for tmsl in tile_matrix_set_links:
if tmsl.tilematrixset:
if tmsl.tilematrixset in self.tilematrixsetlinks:
raise KeyError('TileMatrixSetLink with tilematrixset "%s"'
msg = ('TileMatrixSetLink with tilematrixset "%s"'
' already exists' %
tmsl.tilematrixset)
warnings.warn(msg, RuntimeWarning)
self.tilematrixsetlinks[tmsl.tilematrixset] = tmsl

self.resourceURLs = []
Expand Down

0 comments on commit 4138261

Please sign in to comment.