Skip to content

ValueError: invalid literal for int() when styling output raster from Kriging #97

@faliqadlan

Description

@faliqadlan

Bug Description

When running an Ordinary Kriging interpolation, the process fails at the very end with a ValueError. The error occurs when the plugin attempts to create and apply a color ramp to the output raster layer, indicating it received a color format from QGIS that it was not designed to handle.

Steps to Reproduce

  1. Load a point vector layer with data to be interpolated.
  2. Open the Smart-Map plugin and navigate to the Interpolation -> Ordinary Kriging tab.
  3. Configure the variogram and kriging parameters.
  4. Click the "Interpolate..." button to start the process.
  5. The error occurs after the calculation is complete but before the layer is rendered.

Expected Behavior

The kriging interpolation should complete successfully, and a new raster layer should be created and added to the QGIS map canvas, styled with a default color ramp.

Actual Behavior

The process fails, and a Python error dialog is displayed with the following traceback.

Error Traceback

ValueError: invalid literal for int() with base 10: 'rgb:0.8431373' Traceback (most recent call last): File "C:\Users/faliq/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\Smart_Map\Smart_Map.py", line 3885, in pushButton_Krigagem_clicked Output_Layer_File_tiff = self.export_raster_to_qgis(Input_Table, Output_Layer_File_tiff, Output_Layer_Name, z_field) File "C:\Users/faliq/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\Smart_Map\Smart_Map.py", line 8426, in export_raster_to_qgis self.define_raster_color_ramp(rlayer, Output_Layer_Name) File "C:\Users/faliq/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\Smart_Map\Smart_Map.py", line 8631, in define_raster_color_ramp c1 = [ int(element) for element in rp['color1'].split(',') ] #first color Ex: red ValueError: invalid literal for int() with base 10: 'rgb:0.8431373'

System Information

  • QGIS Version: 3.44.1
  • Smart-Map Plugin Version: 1.5
  • Operating System: Windows

Possible Cause

The error occurs in the define_raster_color_ramp function. The code expects to parse a color string formatted as comma-separated integers (e.g., '215,25,28'). However, the ValueError shows it is receiving the string 'rgb:0.8431373', which cannot be converted to an integer. This suggests a potential incompatibility with how newer QGIS versions might be defining default color ramp values.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions