0

enter image description here

I have raster image of road feature. I want to extract line feature from it. So I run r.thin tool on it of parameter -

{ 'GRASS_RASTER_FORMAT_META' : '', 'GRASS_RASTER_FORMAT_OPT' : '', 'GRASS_REGION_CELLSIZE_PARAMETER' : 0, 'GRASS_REGION_PARAMETER' : None, 'input' : 'C:/Users/User/Music/test111.tif', 'iterations' : 200, 'output' : 'TEMPORARY_OUTPUT' }

and then r.to_vect. But the result of r.thin is giving one or two yellow pixels.

enter image description here

What is wrong I am doing?

1 Answer 1

1

GRASS r.thin command require a NULL/non NULL raster. In your raster probably there are no null cells, so all cells are considered as part of the line, so the result looks correct. First you should set black(0) pixels to null using r.null, it is also available in processing toolbox in the GRASS group. I downloaded your image to show you the steps. enter image description here

Then you can use the r.thin command on the result of r.null.

enter image description here

Finally use r.to.vec

enter image description here

Here are the results of the steps for the upper left corner of your image:

enter image description here

Probably you had better to use Douglas-Pecker simplification on the result of r.to.vec using v.generalize.

1

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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