Skip to content

Commit

Permalink
Honour map and info formats from capabilities instead of hardcoding v…
Browse files Browse the repository at this point in the history
…alues
  • Loading branch information
manisandro committed Nov 28, 2023
1 parent 4d055ea commit 93ac7ad
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 16 deletions.
10 changes: 10 additions & 0 deletions config_generator/capabilities_reader.py
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,16 @@ def read_service_capabilities(self, url, service_name, item):
if drawing_order is not None:
capabilities['drawing_order'] = drawing_order.text.split(',')

# GetMap formats
capabilities['map_formats'] = list(map(lambda el: el.text, root.findall(
'%sCapability/%sRequest/%sGetMap/%sFormat' % (np, np, np, np), ns
)))

# GetFeatureInfo formats
capabilities['info_formats'] = list(map(lambda el: el.text, root.findall(
'%sCapability/%sRequest/%sGetFeatureInfo/%sFormat' % (np, np, np, np), ns
)))

# collect print templates
print_templates = self.print_templates(root, np, ns)
if print_templates:
Expand Down
18 changes: 2 additions & 16 deletions config_generator/map_viewer_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -474,22 +474,8 @@ def theme_item(self, cfg_item, autogenExternalLayers):
self.set_optional_config(cfg_item, 'format', item)
self.set_optional_config(cfg_item, 'tiled', item)

# TODO: availableFormats
item['availableFormats'] = [
'image/jpeg',
'image/png',
'image/png; mode=16bit',
'image/png; mode=8bit',
'image/png; mode=1bit'
]
# TODO: infoFormats
item['infoFormats'] = [
'text/plain',
'text/html',
'text/xml',
'application/vnd.ogc.gml',
'application/vnd.ogc.gml/3.1.1'
]
item['availableFormats'] = cap['map_formats']
item['infoFormats'] = cap['info_formats']

self.set_optional_config(cfg_item, 'scales', item)
self.set_optional_config(cfg_item, 'printScales', item)
Expand Down

0 comments on commit 93ac7ad

Please sign in to comment.