You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The issue come from _buildMetadata method into WebMapTileService class. The function called gather_layers raise an KeyError if there are duplicated element... But It should be better to add elements if they are not already in the dictionary called "contents"? And just add a warning for duplicate layers.
Below example to fix this issue: def gather_layers(parent_elem, parent_metadata): for index, elem in enumerate(parent_elem.findall(_LAYER_TAG)): cm = ContentMetadata( elem, parent=parent_metadata, index=index + 1,parse_remote_metadata=parse_remote_metadata) if cm.id: if not cm.id in self.contents: self.contents[cm.id] = cm else: warnings.war('Content metadata for layer "%s" ' 'already exists' % cm.id) gather_layers(elem, cm)
Thank for help.
Fabien Blarel
The text was updated successfully, but these errors were encountered:
I tried to implement this in my version, and it then triggered a load more KeyErrors later in the _buildMetadata method. I also had to just change these to warnings.warn (not .war?...). Seems to kick up a fuss but got the end result for me. Thanks for posting this!
#Since a while, I am using the wmts function of cartopy but since last week this function does not works returning this error:
KeyError: 'Content metadata for layer "AMSUA_NOAA15_Brightness_Temp_Channel_10" already exists'
The run code is coming from the cartopy web doc.
below the code:
`
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'
if name == 'main':
main()
`
The issue come from _buildMetadata method into WebMapTileService class. The function called gather_layers raise an KeyError if there are duplicated element... But It should be better to add elements if they are not already in the dictionary called "contents"? And just add a warning for duplicate layers.
Below example to fix this issue:
def gather_layers(parent_elem, parent_metadata): for index, elem in enumerate(parent_elem.findall(_LAYER_TAG)): cm = ContentMetadata( elem, parent=parent_metadata, index=index + 1,parse_remote_metadata=parse_remote_metadata) if cm.id: if not cm.id in self.contents: self.contents[cm.id] = cm else: warnings.war('Content metadata for layer "%s" ' 'already exists' % cm.id) gather_layers(elem, cm)
Thank for help.
Fabien Blarel
The text was updated successfully, but these errors were encountered: