lutraconsulting / serval

QGIS plugin for setting raster pixel values
38 stars 11 forks source link

error in using the plugin #1

Closed pcav closed 8 years ago

pcav commented 8 years ago

When clicking on a raster I get:

2016-01-05T15:28:33 1 Traceback (most recent call last): File "/home/paolo/.qgis2/python/plugins/Serval/serval_widget.py", line 99, in changeCellValue self.array[0][0] = float(self.valueEdit.text()) AttributeError: 'ServalWidget' object has no attribute 'array'

erpas commented 8 years ago

Paolo,

thank you for the traceback. Can you please provide some additional info:

  1. Is it a single band raster?
  2. What are CRS of the raster and project - do they match?

The changeCellValue method is called when the user hits Enter or the green arrow is clicked. Are you sure the error shows up when you click on a raster?

Radek

pcav commented 8 years ago
erpas commented 8 years ago

Thanks anyway! I will add some preliminary checks:

AsgerPetersen commented 8 years ago

I have this error too on the very first use of the plugin after its installation. It happens when clicking the green arrow button:

image

On this raster:

Driver: GTiff/GeoTIFF
Files: DTM_1000x1000.tif
Size is 1000, 1000
Coordinate System is:
PROJCS["ETRS89 / UTM zone 32N",
    GEOGCS["ETRS89",
        DATUM["European_Terrestrial_Reference_System_1989",
            SPHEROID["GRS 1980",6378137,298.2572221010002,
                AUTHORITY["EPSG","7019"]],
            AUTHORITY["EPSG","6258"]],
        PRIMEM["Greenwich",0],
        UNIT["degree",0.0174532925199433],
        AUTHORITY["EPSG","4258"]],
    PROJECTION["Transverse_Mercator"],
    PARAMETER["latitude_of_origin",0],
    PARAMETER["central_meridian",9],
    PARAMETER["scale_factor",0.9996],
    PARAMETER["false_easting",500000],
    PARAMETER["false_northing",0],
    UNIT["metre",1,
        AUTHORITY["EPSG","9001"]],
    AUTHORITY["EPSG","25832"]]
Origin = (440000.000000000000000,6410000.000000000000000)
Pixel Size = (460.000000000000000,-370.000000000000000)
Metadata:
  AREA_OR_POINT=Area
Image Structure Metadata:
  COMPRESSION=DEFLATE
  INTERLEAVE=BAND
Corner Coordinates:
Upper Left  (  440000.000, 6410000.000) (  7d59'23.10"E, 57d49'40.51"N)
Lower Left  (  440000.000, 6040000.000) (  8d 4'24.31"E, 54d30'14.58"N)
Upper Right (  900000.000, 6410000.000) ( 15d42'32.99"E, 57d39'14.04"N)
Lower Right (  900000.000, 6040000.000) ( 15d 9'28.29"E, 54d21' 1.32"N)
Center      (  670000.000, 6225000.000) ( 11d44' 9.73"E, 56d 8'22.93"N)
Band 1 Block=256x256 Type=Float32, ColorInterp=Gray
  NoData Value=-9999
AsgerPetersen commented 8 years ago

Ah, I see it is not the exact same error, but probably related to the fix of the error reported by @pcav

erpas commented 8 years ago

Asger, thanks for the comment! Does the error occur when you first click a raster cell and then the green arrow? For now (without the fix mentioned earlier) the array is created when a user clicks a cell. If there is no raster cell selected there is nothing to operate on - I will add a check for that.

pcav commented 8 years ago

I do not recall exactly, but I'd say yes (sorry I haven't time for a proper check now). Thanks for following this up.

AsgerPetersen commented 8 years ago

@erpas It wasn't immediately obvious to me how the plugin worked, so I entered a new raster value, clicked the green arrow and then clicked the cell which I wanted to update. Then got the exception

erpas commented 8 years ago

Asger, thanks for that! I will keep this in mind and will inform a user if he/she decides to save a new cell value before actually selecting the cell.