Skip to content

Commit bcd8e66

Browse files
committed
Omit NoGeometry layers from visibility presets
They are excluded from the theme
1 parent ed6a912 commit bcd8e66

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/config_generator/qgs_reader.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -242,9 +242,11 @@ def __visibility_presets(self, root, theme_item):
242242

243243
# layerId => (short)name map
244244
layer_map = {}
245+
geom_types = {}
245246
for mapLayer in root.findall('.//maplayer'):
246247
layerId = mapLayer.find('./id')
247248
if layerId is not None:
249+
geom_types[layerId.text] = mapLayer.get('wkbType')
248250
if mapLayer.find('shortname') is not None:
249251
layer_map[layerId.text] = mapLayer.find('shortname').text
250252
elif mapLayer.find('layername') is not None:
@@ -272,7 +274,10 @@ def layer_path(layer_id):
272274
for layer in visibilityPreset.findall('./layer'):
273275
layer_id = layer.get('id')
274276
path = layer_path(layer_id)
275-
if layer_map[layer_id] not in hidden_layers and layer.get('visible') == "1" and path:
277+
if layer_map[layer_id] not in hidden_layers and \
278+
geom_types[layer_id] != 'WKBNoGeometry' and geom_types[layer_id] != 'NoGeometry' and \
279+
layer.get('visible') == "1" and path \
280+
:
276281
result[name][path] = layer.get('style')
277282
for checkedGroupNode in visibilityPreset.findall('./checked-group-nodes/checked-group-node'):
278283
groupid = checkedGroupNode.get('id')

0 commit comments

Comments
 (0)