I want to convert a raster map encoding directional flows (the output of r.terraflow) to a vector map. I'm using r.thin to process the output. It terminates successfully with 0 pixels removed during the last iteration. Yet when I try to vectorise the result with r.to.vect and feature=line, I get the following error message:

Extracting lines...
ERROR: Raster map is not thinned properly.
   Please run r.thin.

I have tried rerunning r.thin on the already thinned output, with the same result. I did not find anything in the documentation of either r.thin or r.to.vect to suggest what might be the problem here or how to fix it.


The r.thin module will thin only the non-zero cells in a raster map. Please check that this condition is fulfilled. Perhaps you have to r.null on the map to set no data pixels to NULL beforehand.

  • Thanks for the suggestion. I've tried both adding a null map and removing it with r.null and I get the same result. Any other ideas? – Lars Kotthoff Mar 10 '12 at 12:03

In case it is relevant:

r.thin changed behaviour from GRASS 6 to GRASS 7. In GRASS 6, cells with non-0 values are considered for thinning, while in GRASS 7, cells with non-null values are considered for thinning.

This means that you may have to change your 0 cells to null cells before r.thin will work as expected. All cells with non-null values are considered by r.thin in GRASS 7, so if the input raster contains cells with value 0, the result could also contain cells with value 0.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.