Skip to content

Commit

Permalink
check for snap reference layer before starting layer alignment
Browse files Browse the repository at this point in the history
  • Loading branch information
Samweli committed Nov 6, 2023
1 parent dead5e4 commit 21e9984
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 2 deletions.
14 changes: 13 additions & 1 deletion src/cplus_plugin/gui/qgis_cplus_main.py
Original file line number Diff line number Diff line change
Expand Up @@ -1228,7 +1228,13 @@ def pathways_analysis_done(
snapping_enabled = settings_manager.get_value(
Settings.SNAPPING_ENABLED, default=False, setting_type=bool
)
if snapping_enabled:
reference_layer = settings_manager.get_value(Settings.SNAP_LAYER)
reference_layer_path = Path(reference_layer)
if (
snapping_enabled
and os.path.exists(reference_layer)
and reference_layer_path.is_file()
):
self.snap_analyzed_pathways(
pathways, models, priority_layers_groups, extent
)
Expand Down Expand Up @@ -1999,7 +2005,13 @@ def run_priority_analysis(self, models, priority_layers_groups, extent):
settings_model = settings_manager.get_implementation_model(str(model.uuid))

for layer in settings_model.priority_layers:
if layer is None:
continue

settings_layer = settings_manager.get_priority_layer(layer.get("uuid"))
if settings_layer is None:
continue

pwl = settings_layer.get("path")

missing_pwl_message = (
Expand Down
5 changes: 4 additions & 1 deletion src/cplus_plugin/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -316,7 +316,10 @@ def align_rasters(
)
raise Exception(align.errorMessage())
except Exception as e:
log(f"Problem occured when snapping, {str(e)}")
log(
f"Problem occured when snapping, {str(e)}."
f" Update snap settings and re-run the analysis"
)

log(
f"Finished snapping using resampling method {resample_method_value.name} with"
Expand Down

0 comments on commit 21e9984

Please sign in to comment.