Skip to content

Commit b2ba43f

Browse files
committed
Read attribute aliases and store them in ogcConfig and featureInfoConfig resources
1 parent 71d7546 commit b2ba43f

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed

src/config_generator/capabilities_reader.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -348,13 +348,13 @@ def collect_wms_layers(self, layer, layer_names, internal_print_layers, ns, np,
348348
return None
349349

350350
# collect attributes
351-
attributes = []
351+
attributes = {}
352352
attrs = layer.find('%sAttributes' % np, ns)
353353
if attrs is not None:
354354
for attr in attrs.findall('%sAttribute' % np, ns):
355-
attributes.append(attr.get('alias', attr.get('name')))
356-
attributes.append('geometry')
357-
attributes.append('maptip')
355+
attributes[attr.get('name')] = attr.get('alias', attr.get('name'))
356+
attributes['geometry'] = 'geometry'
357+
attributes['maptip'] = 'maptip'
358358

359359
if attributes:
360360
wms_layer['attributes'] = attributes

src/config_generator/feature_info_service_config.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -161,10 +161,11 @@ def collect_wms_layers(self, layer):
161161
# collect attributes
162162
if 'attributes' in layer:
163163
attributes = []
164-
for attr in layer['attributes']:
164+
for attr, alias in layer['attributes'].items():
165165
# NOTE: use ordered keys
166166
attribute = OrderedDict()
167167
attribute['name'] = attr
168+
attribute['alias'] = alias
168169

169170
attributes.append(attribute)
170171

0 commit comments

Comments
 (0)