From 0527ba1fa516650b33fec620b57169b6e582b027 Mon Sep 17 00:00:00 2001 From: SJiB Date: Tue, 7 May 2024 13:55:05 +0200 Subject: [PATCH 1/2] Add code to skip labels if LabelText is empty. Backported from teksi tww https://github.com/teksi/wastewater/blob/3acfba249866d299f8a22e249d9f1e475fe7b88d/plugin/teksi_wastewater/interlis/interlis_model_mapping/interlis_exporter_to_intermediate_schema.py#L2667 and following --- qgepqwat2ili/qgep/export.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/qgepqwat2ili/qgep/export.py b/qgepqwat2ili/qgep/export.py index ec9d7793..7fb27d24 100644 --- a/qgepqwat2ili/qgep/export.py +++ b/qgepqwat2ili/qgep/export.py @@ -1090,6 +1090,15 @@ def textpos_common(row, t_type, geojson_crs_def): layer_name = label["properties"]["Layer"] obj_id = label["properties"]["qgep_obj_id"] + print(f"label[properties]: {label['properties']}") + + if not label["properties"]["LabelText"]: + logger.warning( + f"Label of object '{obj_id}' from layer '{layer_name}' is empty and will not be exported" + ) + continue + + if layer_name == "vw_qgep_reach": if obj_id not in tid_for_obj_id["haltung"]: logger.warning(f"Label for haltung `{obj_id}` exists, but that object is not part of the export") From 60a269c53a31f7b2209513a775d5496fafcee1aa Mon Sep 17 00:00:00 2001 From: SJiB Date: Tue, 7 May 2024 15:59:34 +0200 Subject: [PATCH 2/2] Add also to qgepdss\export.py and qgepsia405/export.py --- qgepqwat2ili/qgepdss/export.py | 8 ++++++++ qgepqwat2ili/qgepsia405/export.py | 8 ++++++++ 2 files changed, 16 insertions(+) diff --git a/qgepqwat2ili/qgepdss/export.py b/qgepqwat2ili/qgepdss/export.py index eec08cda..41545c03 100644 --- a/qgepqwat2ili/qgepdss/export.py +++ b/qgepqwat2ili/qgepdss/export.py @@ -3561,6 +3561,14 @@ def textpos_common(row, t_type, geojson_crs_def): layer_name = label["properties"]["Layer"] obj_id = label["properties"]["qgep_obj_id"] + print(f"label[properties]: {label['properties']}") + + if not label["properties"]["LabelText"]: + logger.warning( + f"Label of object '{obj_id}' from layer '{layer_name}' is empty and will not be exported" + ) + continue + if layer_name == "vw_qgep_reach": if obj_id not in tid_for_obj_id["haltung"]: logger.warning(f"Label for haltung `{obj_id}` exists, but that object is not part of the export") diff --git a/qgepqwat2ili/qgepsia405/export.py b/qgepqwat2ili/qgepsia405/export.py index 69f9c0f2..90e5e58a 100644 --- a/qgepqwat2ili/qgepsia405/export.py +++ b/qgepqwat2ili/qgepsia405/export.py @@ -1089,6 +1089,14 @@ def textpos_common(row, t_type, geojson_crs_def): layer_name = label["properties"]["Layer"] obj_id = label["properties"]["qgep_obj_id"] + print(f"label[properties]: {label['properties']}") + + if not label["properties"]["LabelText"]: + logger.warning( + f"Label of object '{obj_id}' from layer '{layer_name}' is empty and will not be exported" + ) + continue + if layer_name == "vw_qgep_reach": if obj_id not in tid_for_obj_id["haltung"]: logger.warning(f"Label for haltung `{obj_id}` exists, but that object is not part of the export")