lutraconsulting/serval

Errors converting string to float

Opened this issue · 0 comments

Hi!
I've been using the serval plugin to edit heightmaps and have encountered an issue, whenever negative numbers are in use in the value textbox the following converting error occurs.

2023-11-26T05:29:30 WARNING Traceback (most recent call last):
File "C:\Users/.../QGIS/QGIS3\profiles\default/python/plugins\Serval\serval.py", line 726, in set_active_raster
old_spin_boxes_values = self.spin_boxes.get_values()
File "C:\Users/.../QGIS/QGIS3\profiles\default/python/plugins\Serval\band_spin_boxes.py", line 82, in get_values
value = int(raw_val) if self.data_types[nr -1] ValueError: could not convert string to float: '−9999.0000'

I spotted the problem to the minus sign, it is for some reason unknown to me in unicode.

I'm not proficient enough in python but I did try to fix it by simply adding
raw_val = raw_val.replace(chr(8722), "-")

In band_spin_boxes.py prior to the string float converting. But it didn't work any better.

For now I manually replace the incorrect sign value in the textbox when the error occur in qgis.