mkondratyev85 / raster_tracer

MIT License
65 stars 9 forks source link

AttributeError 'PointTool' object has no attribute 'to_indexes' #13

Closed havatv closed 4 years ago

havatv commented 4 years ago

I am using QGIS 3.14 on Ubuntu 18.04, and downloaded the plugin from plugins.qgis.org today. I receive the following error message when trying to start tracing by clicking on any location in a binary raster image.

2020-07-22T09:42:13     WARNING    Traceback (most recent call last):
              File "/home/tveite/.local/share/QGIS/QGIS3/profiles/default/python/plugins/raster_tracer/pointtool.py", line 217, in canvasReleaseEvent
              i1, j1 = self.to_indexes(x1, y1)
             AttributeError: 'PointTool' object has no attribute 'to_indexes'
mkondratyev85 commented 4 years ago

What do you mean by binary raster image? Right now plugin works only with images with standard RGB color space. If you work with image that have only black and white pixels I suggest you to convert it into RGB (which obviously means increase in size) and try again.

havatv commented 4 years ago

OK. I got an error message when I tried a grayscale image, so I binarised it. Will try with an RGB image. No error message with RGB, but I don't know how to get the semi-automatic tracing to start. Is there a user manual / help page somewhere? And where can I find the information that only RGB images are supported?

mkondratyev85 commented 4 years ago

It is written on the github page. There you can find a gif showing a process of tracing.

https://github.com/mkondratyev85/raster_tracer

To switch between 'trace' mode and 'semi-automatic' mode you can press a key. It' also useful to select a colour you would like to trace with colour-picker as shown on the gif.

havatv commented 4 years ago

I am still not able to get the tracing to work.

  1. I added the RBG image
  2. I created a memory layer of type LineString
  3. I had the memory layer active
  4. I clicked on the plugin icon, and got the same shape of the cursor as shown on github page
  5. I clicked on a pixel in the RGB image.
  6. I clicked on a nearby pixel of the same colour in the RBG image, but no line is shown.
  7. After finishing "digitizing", a new feature seems to have been added

When trying to save, I get the following error message:

2020-07-23T08:34:24     WARNING    Commit errors:
              ERROR: 3 feature(s) not added - geometry type is not compatible with the current layer.
mkondratyev85 commented 4 years ago

That's clearly some bug in raster_tracer. Could you share your raster map so I reproduce the bug on my laptop? mkondratyev85@gmail.com

havatv commented 4 years ago

The error message points to a geometry type problem. The problem seems to be that the feature geometries generated are not of type LineString, but MultiLineString. If I specify the geometry of the (memory) layer to be MultiLineString (instead of LineString), the plugin works as demonstrated in the github animation.

Could it be an idea to create help for the plugin, and add a "Help" button for it in the "GUI"? Then the users of the plugin would not have to consult github to get the information that they need to use the plugin.

mkondratyev85 commented 4 years ago

The issue is closed after #18