Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Index score integration #330

Merged
merged 8 commits into from
Sep 29, 2024
Merged

Index score integration #330

merged 8 commits into from
Sep 29, 2024

Conversation

osundwajeff
Copy link
Collaborator

@osundwajeff osundwajeff commented Sep 27, 2024

Default Index Score Workflow Implementation

Tickets #318 and #319

Summary of Changes

This update introduces a concrete implementation of the DefaultIndexScoreWorkflow, a class responsible for executing the "Use Default Index Score" workflow in QGIS. The workflow allows for the creation of raster masks for features within a bounding box layer, combining those rasters into a VRT (Virtual Raster Tile), and adding the VRT to the QGIS map.

Key Features:

  • Workflow Execution:

    • Iterates through bounding box (self.bboxes_layer) features.
    • Creates individual raster masks using the create_raster method.
    • Combines all raster masks into a single VRT using the create_raster_vrt method.
  • Cancellation Handling:

    • The workflow checks for cancellation using self.feedback.isCanceled() before starting long-running tasks (e.g., raster creation and VRT generation) to ensure it can stop if necessary.
  • Dynamic Layer Naming:

    • The VRT layer is added to the QGIS project with a dynamic name that replaces underscores (_) in the ID attribute with spaces for readability.

Methods:

  1. execute: Manages the overall workflow, including logging, raster mask creation, and VRT generation.
  2. create_raster: Generates a raster mask for a given feature's geometry and saves it as a .tif file.
  3. create_raster_vrt: Combines all generated raster masks into a VRT and adds it to the QGIS map.

Error Handling:

  • In case of missing raster masks, it logs a warning and skips VRT generation.
  • If the VRT layer cannot be added to the map, it logs a critical error.

VRT function and Rescaled index score to range [ 0 - 5 ]
image

VRT -1:
image

VRT-2:
image

VRT-3:
image

VRTs added to map (For the three indexes):
image

Directory structure:
image

lower level:
image

@osundwajeff osundwajeff marked this pull request as ready for review September 29, 2024 16:09
@timlinux timlinux merged commit 219f2f2 into main Sep 29, 2024
11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants