Skip to content

Commit

Permalink
Merge pull request #171 from QGEP/poa_upgrade_used_qgep_docker_image
Browse files Browse the repository at this point in the history
Upgrade qgep used docker image
  • Loading branch information
ponceta authored Oct 22, 2024
2 parents 770afb7 + d0ba979 commit 7372cb2
Show file tree
Hide file tree
Showing 10 changed files with 66 additions and 104 deletions.
56 changes: 28 additions & 28 deletions qgepqwat2ili/gui/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,15 +83,15 @@ def action_importc(plugin):
# neu 26.7.2023 analog action_import
global importc_dialog # avoid garbage collection

print("set flagskipvalidation_import")
# print("set flagskipvalidation_import")

iface.messageBar().pushMessage("Info", "action import", level=Qgis.Info)

importc_dialog = GuiImportc(plugin.iface.mainWindow())

# # 19.4.2023 add option for additional import configuration
def action_do_importc():
print("Open import dialog config")
# print("Open import dialog config")
if importc_dialog.skipvalidation_import:
importc_dialog.skipvalidation_import

Expand Down Expand Up @@ -149,7 +149,7 @@ def action_import(plugin):

# Check if validating is selected
if flagskipvalidation_import:
print("Validation will be skipped!")
# print("Validation will be skipped!")
progress_dialog.setLabelText("No validation of input file...")
else:
# Validating the input file
Expand Down Expand Up @@ -199,7 +199,7 @@ def action_import(plugin):
# 23.7.2022 rausgenommen - da in ili2db gesetzt
# imodel = import_dialog.label_importmodelname.text()
tmplabeltext = "Creating ili schema..." + imodel
print(tmplabeltext)
# print(tmplabeltext)
# breakpoint()
progress_dialog.setLabelText(tmplabeltext)

Expand Down Expand Up @@ -292,7 +292,7 @@ def action_import(plugin):
# imodel,
)
else:
# print(imodel)
# # print(imodel)
# breakpoint()
progress_dialog.close()
show_failure(
Expand Down Expand Up @@ -381,11 +381,11 @@ def action_do_export():

# neu 12.7.2022
emodel = export_dialog.comboBox_modelselection.currentText()
print(emodel)
# print(emodel)

# neu 3.4.2023 added float()
eorientation = float(export_dialog.comboBox_orientation.currentText())
print(eorientation)
# print(eorientation)

# Prepare file dialog
default_folder = QgsSettings().value(
Expand Down Expand Up @@ -425,15 +425,15 @@ def action_do_export():
check_organisation = False
check_organisation = check_organisation_subclass_data()
if check_organisation:
print("OK: Integrity checks organisation")
# print("OK: Integrity checks organisation")
show_success(
"Sucess",
"OK: Integrity checks organisation",
None,
)
else:
progress_dialog.close()
print("number of subclass elements of organisation NOT CORRECT")
# print("number of subclass elements of organisation NOT CORRECT")
show_failure(
"ERROR: number of subclass elements of organisation NOT CORRECT in schema qgep_od",
"Add missing obj_id in organisation subclasses so that number of subclass elements match organisation elements. See qgep logs tab for details.",
Expand All @@ -448,15 +448,15 @@ def action_do_export():
check_wastewater_structure = False
check_wastewater_structure = check_wastewater_structure_subclass_data()
if check_wastewater_structure:
print("OK: Integrity checks wastewater_structure")
# print("OK: Integrity checks wastewater_structure")
show_success(
"Sucess",
"OK: Integrity checks wastewater_structure",
None,
)
else:
progress_dialog.close()
print("ERROR: number of subclass elements of wastewater_structure NOT CORRECT")
# print("ERROR: number of subclass elements of wastewater_structure NOT CORRECT")
show_failure(
"ERROR: number of subclass elements of wastewater_structure NOT CORRECT in schema qgep_od",
"Add missing obj_id in wastewater_structure subclasses so that number of subclass elements match wastewater_structure elements. See qgep logs tab for details.",
Expand All @@ -469,16 +469,16 @@ def action_do_export():
check_identifier = False
check_identifier = check_identifier_null()
if check_identifier:
print("OK: Integrity checks identifiers not isNull")
# print("OK: Integrity checks identifiers is not NULL")
show_success(
"Sucess",
"OK: Integrity checks identifiers not isNull",
"OK: Integrity checks identifiers is not NULL",
None,
)

else:
progress_dialog.close()
print("INFO: missing identifiers")
# print("INFO: missing identifiers")
show_hint(
"INFO: Missing identifiers in schema qgep_od",
"Add missing identifiers to get a valid INTERLIS export file. See qgep logs tab for details.",
Expand All @@ -492,16 +492,16 @@ def action_do_export():
check_fk_owner = False
check_fk_owner = check_fk_owner_null()
if check_fk_owner:
print("OK: Integrity checks fk_owner not isNull")
# print("OK: Integrity checks fk_owner is not NULL")
show_success(
"Sucess",
"OK: Integrity checks fk_owner not isNull",
"OK: Integrity checks fk_owner is not NULL",
None,
)

else:
progress_dialog.close()
print("ERROR: missing MANDATORY fk_owner")
# print("ERROR: missing MANDATORY fk_owner")
show_failure(
"ERROR: Missing MANDATORY fk_owner in schema qgep_od",
"Add missing MANDATORY fk_owner to get a valid INTERLIS export file. See qgep logs tab for details.",
Expand All @@ -514,16 +514,16 @@ def action_do_export():
check_fk_operator = False
check_fk_operator = check_fk_operator_null()
if check_fk_operator:
print("OK: Integrity checks fk_operator not isNull")
# print("OK: Integrity checks fk_operator is not NULL")
show_success(
"Sucess",
"OK: Integrity checks fk_operator not isNull",
"OK: Integrity checks fk_operator is not NULL",
None,
)

else:
progress_dialog.close()
print("ERROR: missing MANDATORY fk_operator")
# print("ERROR: missing MANDATORY fk_operator")
show_failure(
"ERROR: Missing MANDATORY fk_operator in schema qgep_od",
"Add missing MANDATORY fk_operator to get a valid INTERLIS export file. See qgep logs tab for details.",
Expand All @@ -537,16 +537,16 @@ def action_do_export():
check_fk_dataowner = False
check_fk_dataowner = check_fk_dataowner_null()
if check_fk_dataowner:
print("OK: Integrity checks fk_dataowner not isNull")
# print("OK: Integrity checks fk_dataowner is not NULL")
show_success(
"Sucess",
"OK: Integrity checks fk_dataowner not isNull",
"OK: Integrity checks fk_dataowner is not NULL",
None,
)

else:
progress_dialog.close()
print("INFO: missing fk_dataowner")
# print("INFO: missing fk_dataowner")
show_hint(
"INFO: Missing fk_dataowner in schema qgep_od",
"Add missing fk_dataowner to get a valid INTERLIS export file when converting to Release 2020 (will bei MANDATORY). See qgep logs tab for details.",
Expand All @@ -559,16 +559,16 @@ def action_do_export():
check_fk_provider = False
check_fk_provider = check_fk_provider_null()
if check_fk_provider:
print("OK: Integrity checks fk_provider not isNull")
# print("OK: Integrity checks fk_provider is not NULL")
show_success(
"Sucess",
"OK: Integrity checks fk_provider not isNull",
"OK: Integrity checks fk_provider is not NULL",
None,
)

else:
progress_dialog.close()
print("INFO: missing fk_provider")
# print("INFO: missing fk_provider")
show_hint(
"INFO: Missing fk_provider in schema qgep_od",
"Add missing fk_provider to get a valid INTERLIS export file when converting to Release 2020 (will bei MANDATORY). See qgep logs tab for details.",
Expand Down Expand Up @@ -635,12 +635,12 @@ def action_do_export():
# neu 12.7.2022
progress_dialog.setLabelText(emodel)

# print("GFG printed immediately.")
# # print("GFG # printed immediately.")
# time.sleep(5.5)

# delays the execution
# for 5.5 secs.
# print("GFG printed after 5.5 secs.")
# # print("GFG # printed after 5.5 secs.")

progress_dialog.setValue(25)

Expand Down
21 changes: 9 additions & 12 deletions qgepqwat2ili/qgep/export.py
Original file line number Diff line number Diff line change
Expand Up @@ -190,10 +190,9 @@ def base_common(row, type_name):
def wastewater_structure_common(row):
"""
Returns common attributes for wastewater_structure
ATTENTION : Mapping of 3D wastewater_structure->abwasserbauerk
is not fully implemented.
"""
logger.warning(
"Mapping of wastewater_structure->abwasserbauwerk is not fully implemented."
)
return {
# --- abwasserbauwerk ---
"akten": row.records,
Expand Down Expand Up @@ -420,9 +419,9 @@ def textpos_common(row, t_type, geojson_crs_def):

# --- _rel_ ---
# accessibility__REL, bypass__REL, emergency_spillway__REL, financing__REL, fk_dataowner__REL, fk_main_cover__REL, fk_main_wastewater_node__REL, fk_operator__REL, fk_owner__REL, fk_provider__REL, function__REL, renovation_necessity__REL, rv_construction_type__REL, status__REL, stormwater_tank_arrangement__REL, structure_condition__REL
logger.warning(
"QGEP field special_structure.upper_elevation has no equivalent in the interlis model. It will be ignored."
)

# QGEP field special_structure.upper_elevation is a 3D attribute and has no equivalent in the INTERLIS 2D model release used. It will be ignored for now and not supported with QGEP.

spezialbauwerk = ABWASSER.spezialbauwerk(
# FIELDS TO MAP TO ABWASSER.spezialbauwerk
# --- baseclass ---
Expand Down Expand Up @@ -603,9 +602,8 @@ def textpos_common(row, t_type, geojson_crs_def):
# --- _rel_ ---
# fk_dataowner__REL, fk_hydr_geometry__REL, fk_provider__REL, fk_wastewater_structure__REL

logger.warning(
"QGEP field wastewater_node.fk_hydr_geometry has no equivalent in the interlis model. It will be ignored."
)
# QGEP field wastewater_node.fk_hydr_geometry has no equivalent in the interlis model. It will be ignored.

abwasserknoten = ABWASSER.abwasserknoten(
# FIELDS TO MAP TO ABWASSER.abwasserknoten
# --- baseclass ---
Expand Down Expand Up @@ -645,9 +643,8 @@ def textpos_common(row, t_type, geojson_crs_def):
# --- _rel_ ---
# elevation_determination__REL, fk_dataowner__REL, fk_pipe_profile__REL, fk_provider__REL, fk_reach_point_from__REL, fk_reach_point_to__REL, fk_wastewater_structure__REL, horizontal_positioning__REL, inside_coating__REL, material__REL, reliner_material__REL, relining_construction__REL, relining_kind__REL

logger.warning(
"QGEP field reach.elevation_determination has no equivalent in the interlis model. It will be ignored."
)
# QGEP field reach.elevation_determination has no equivalent in the interlis model. It will be ignored.

haltung = ABWASSER.haltung(
# FIELDS TO MAP TO ABWASSER.haltung
# --- baseclass ---
Expand Down
2 changes: 1 addition & 1 deletion qgepqwat2ili/qgep/import_.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ def get_vl_instance(vl_table, value):
# TODO : return "other" (or other applicable value) rather than None, or even throwing an exception, would probably be better
row = qgep_session.query(vl_table).filter(vl_table.value_de == value).first()
if row is None:
logger.warning(
logger.debug(
f'Could not find value `{value}` in value list "{vl_table.__table__.schema}.{vl_table.__name__}". Setting to None instead.'
)
return None
Expand Down
5 changes: 2 additions & 3 deletions qgepqwat2ili/qgepdss/export.py
Original file line number Diff line number Diff line change
Expand Up @@ -218,10 +218,9 @@ def surface_water_bodies_common(row):
def wastewater_structure_common(row):
"""
Returns common attributes for wastewater_structure
ATTENTION : Mapping of 3D wastewater_structure->abwasserbauerk
is not fully implemented.
"""
logger.warning(
"Mapping of wastewater_structure->abwasserbauwerk is not fully implemented."
)
return {
# --- abwasserbauwerk ---
"akten": row.records,
Expand Down
2 changes: 1 addition & 1 deletion qgepqwat2ili/qgepdss/import_.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ def get_vl_instance(vl_table, value):
if row is None:
# write logger.warning only if value is not None
if value is not None:
logger.warning(
logger.debug(
f'Could not find value `{value}` in value list "{vl_table.__table__.schema}.{vl_table.__name__}". Setting to None instead.'
)
return None
Expand Down
21 changes: 9 additions & 12 deletions qgepqwat2ili/qgepsia405/export.py
Original file line number Diff line number Diff line change
Expand Up @@ -188,10 +188,9 @@ def base_common(row, type_name):
def wastewater_structure_common(row):
"""
Returns common attributes for wastewater_structure
ATTENTION : Mapping of 3D wastewater_structure->abwasserbauerk
is not fully implemented.
"""
logger.warning(
"Mapping of wastewater_structure->abwasserbauwerk is not fully implemented."
)
return {
# --- abwasserbauwerk ---
"akten": row.records,
Expand Down Expand Up @@ -418,9 +417,9 @@ def textpos_common(row, t_type, geojson_crs_def):

# --- _rel_ ---
# accessibility__REL, bypass__REL, emergency_spillway__REL, financing__REL, fk_dataowner__REL, fk_main_cover__REL, fk_main_wastewater_node__REL, fk_operator__REL, fk_owner__REL, fk_provider__REL, function__REL, renovation_necessity__REL, rv_construction_type__REL, status__REL, stormwater_tank_arrangement__REL, structure_condition__REL
logger.warning(
"QGEP field special_structure.upper_elevation has no equivalent in the interlis model. It will be ignored."
)

# QGEP field special_structure.upper_elevation is a 3D attribute and has no equivalent in the INTERLIS 2D model release used. It will be ignored for now and not supported with QGEP.

spezialbauwerk = ABWASSER.spezialbauwerk(
# FIELDS TO MAP TO ABWASSER.spezialbauwerk
# --- baseclass ---
Expand Down Expand Up @@ -601,9 +600,8 @@ def textpos_common(row, t_type, geojson_crs_def):
# --- _rel_ ---
# fk_dataowner__REL, fk_hydr_geometry__REL, fk_provider__REL, fk_wastewater_structure__REL

logger.warning(
"QGEP field wastewater_node.fk_hydr_geometry has no equivalent in the interlis model. It will be ignored."
)
# QGEP field wastewater_node.fk_hydr_geometry has no equivalent in the interlis model. It will be ignored.

abwasserknoten = ABWASSER.abwasserknoten(
# FIELDS TO MAP TO ABWASSER.abwasserknoten
# --- baseclass ---
Expand Down Expand Up @@ -643,9 +641,8 @@ def textpos_common(row, t_type, geojson_crs_def):
# --- _rel_ ---
# elevation_determination__REL, fk_dataowner__REL, fk_pipe_profile__REL, fk_provider__REL, fk_reach_point_from__REL, fk_reach_point_to__REL, fk_wastewater_structure__REL, horizontal_positioning__REL, inside_coating__REL, material__REL, reliner_material__REL, relining_construction__REL, relining_kind__REL

logger.warning(
"QGEP field reach.elevation_determination has no equivalent in the interlis model. It will be ignored."
)
# QGEP field reach.elevation_determination has no equivalent in the interlis model. It will be ignored.

haltung = ABWASSER.haltung(
# FIELDS TO MAP TO ABWASSER.haltung
# --- baseclass ---
Expand Down
2 changes: 1 addition & 1 deletion qgepqwat2ili/qgepsia405/import_.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ def get_vl_instance(vl_table, value):
# TODO : return "other" (or other applicable value) rather than None, or even throwing an exception, would probably be better
row = qgep_session.query(vl_table).filter(vl_table.value_de == value).first()
if row is None:
logger.warning(
logger.debug(
f'Could not find value `{value}` in value list "{vl_table.__table__.schema}.{vl_table.__name__}". Setting to None instead.'
)
return None
Expand Down
18 changes: 7 additions & 11 deletions qgepqwat2ili/qwat/export.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,10 +80,10 @@ def clamp(val, min_val=None, max_val=None, accept_none=False):
if val is None and accept_none:
return None
if (val is None) or (min_val is not None and val < min_val):
logger.warning(f"Value '{val}' was clamped to {min_val}")
logger.debug(f"Value '{val}' was clamped to {min_val}")
val = min_val
elif max_val is not None and val > max_val:
logger.warning(f"Value '{val}' was clamped to {max_val}")
logger.debug(f"Value '{val}' was clamped to {max_val}")
val = max_val
return val

Expand All @@ -100,11 +100,9 @@ def sanitize_geom(val):
return ST_RemoveRepeatedPoints(ST_Force2D(ST_Transform(val, 2056)), 0.002)

def create_metaattributes(instance):
logger.warning(
"QWAT doesn't define meta attributes. Dummy metaattributes will be created with an arbitrary date."
)

# NOTE : QWAT doesn't define meta attributes, so we create a dummy metattribute
"""
Create dummy meta attributes since QWAT doesn't define these yet
"""
metaattribute = WASSER.metaattribute(
# FIELDS TO MAP TO WASSER.metaattribute
# --- metaattribute ---
Expand Down Expand Up @@ -343,7 +341,7 @@ def leitungsknoten_common(row):
# _rel_ --- leak.label_2_visible__REL, leak.label_1_visible__REL, leak.fk_cause__REL, leak.fk_pipe__REL

if row.fk_pipe__REL is None:
logger.warning(
logger.debug(
f"Cannot export QWAT.leak {row.id} as it has no related pipe, which are mandatory in SIA405."
)
continue
Expand Down Expand Up @@ -757,9 +755,7 @@ def leitungsknoten_common(row):
leitung_b.t_ili_tid = leitung_b.obj_id

# We split the geometry
logger.warning(
"Pipe will be split at valve to accomodate SIA405's representation. However, split will occur at the middle of the pipe, not taking into account the actual valve's position"
)
# Pipe will be split at valve to accomodate SIA405's representation. However, split will occur at the middle of the pipe, not taking into account the actual valve's position
# TODO the geometry of the new node does not necessarily lie in the middle (nor on the segment)
leitung_a.geometrie = ST_ForceCurve(
sanitize_geom(ST_LineSubstring(ST_CurveToLine(leitung_a.geometrie), 0, 0.5))
Expand Down
Loading

0 comments on commit 7372cb2

Please sign in to comment.