Skip to content

Commit

Permalink
Honour featureReport configuration
Browse files Browse the repository at this point in the history
  • Loading branch information
manisandro committed Sep 13, 2024
1 parent 9a17864 commit 5a08595
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions src/config_generator/map_viewer_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -394,6 +394,7 @@ def theme_item(self, cfg_item, themes_config, assets_dir, autogenExternalLayers,

item['mapCrs'] = cfg_item.get('mapCrs', themes_config.get('defaultMapCrs', 'EPSG:3857'))
self.set_optional_config(cfg_item, 'additionalMouseCrs', item)
featureReports = cfg_item.get("featureReport", {})

bbox = OrderedDict()
bbox['crs'] = 'EPSG:4326'
Expand Down Expand Up @@ -428,7 +429,7 @@ def theme_item(self, cfg_item, themes_config, assets_dir, autogenExternalLayers,
newExternalLayers = []
for layer in root_layer.get('layers', []):
layers.append(self.collect_layers(
layer, search_layers, 1, collapseLayerGroupsBelowLevel, newExternalLayers, service_name))
layer, search_layers, 1, collapseLayerGroupsBelowLevel, newExternalLayers, service_name, featureReports))

# Inject crs in wmts resource string
for entry in newExternalLayers:
Expand Down Expand Up @@ -658,7 +659,7 @@ def set_optional_config(self, cfg_item, field, item):
if field in cfg_item:
item[field] = cfg_item.get(field)

def collect_layers(self, layer, search_layers, level, collapseBelowLevel, externalLayers, service_name):
def collect_layers(self, layer, search_layers, level, collapseBelowLevel, externalLayers, service_name, featureReports):
"""Recursively collect layer tree from capabilities.
:param obj layer: Layer or group layer
Expand All @@ -677,7 +678,7 @@ def collect_layers(self, layer, search_layers, level, collapseBelowLevel, extern
for sublayer in layer['layers']:
# recursively collect sub layer
sublayers.append(self.collect_layers(
sublayer, search_layers, level + 1, collapseBelowLevel, externalLayers, service_name))
sublayer, search_layers, level + 1, collapseBelowLevel, externalLayers, service_name, featureReports))

# abstract
if 'abstract' in layer:
Expand Down Expand Up @@ -768,7 +769,9 @@ def collect_layers(self, layer, search_layers, level, collapseBelowLevel, extern
if layer['name'] in search_layers:
item_layer['searchterms'] = [search_layers.get(layer['name'])]

# TODO: featureReport
# featureReport
if layer['name'] in featureReports:
item_layer['featureReport'] = featureReports[layer['name']]

return item_layer

Expand Down

0 comments on commit 5a08595

Please sign in to comment.