Skip to content

Three Issues Regarding the Accuracy Processing Script (Potential Solutions Included) #413

@Cenan-Alhassan

Description

@Cenan-Alhassan

Hello! While working on the scp_8:accuracy processing script, I identified three major issues that prevent it from working properly.

Issue 1: The layer type of the reference parameter is not properly identified

In this image, I want to pass a vector as the reference.
Image

I get the following error:

Image

It is referring to this part of the code:

Image

Since I did not provide a raster reference, the first if statement should be run and the else statement ignored, and yet that is not the case. The reason for that is that when a raster is not given, reference = '', not reference = None. Therefore, the script runs the raster code block even if only a vector is given, breaking the code.

Issue 2: Current usage of the 'Reference vector' parameter is not supported by rs.cross_classification

Please take a look at the following example:

I have a vector file train.gpkg. If I pass it to the Reference Vector parameter as a file path:

Image

Internally, the variable reference (shown in the third image on line 124) is the following: C:/Users/User/Downloads/train.gpkg. This is a valid value for the rs.cross_classification function.

If I have train.gpkg as a layer named train_data:

Image

Internally, the variable reference will be the layer identifier: train_data_41209414_96e1_4653_8873_e01a72c9c581. Passing this to rs.cross_classification breaks the function. A potential solution is to force the user to choose a file path, since I am unsure why this format breaks the function.

Issue 3: output_path is taken as a directory path rather than a file path

According to the documentation of rs.cross_classification, the output_path parameter refers to the output path for the classification raster:

Image

Despite this fact, the processing script asks for a directory path:

Image

This is misleading. Rather than the output raster and output csv being inside the Downloads folder, the output paths will actually be C:\Users\User\Downloads.tif and C:\Users\User\Downloads.csv respectively. A direct solution would be to replace the QgsProcessingParameterFolderDestination parameter to a QgsProcessingParameterFileDestination.

I can confirm all these fixes work on my machine. If you agree with any of these fixes, I would love to properly contribute to the GitHub repo. Please let me know if I should.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions