I have a set of vector lines in grass which I need to convert into polygons. However, because of bad base data, the polygons don't always close. To fix this, I need to extend each disjointed line by a certain distance and connect it to the first line it hits. The problem is that I can't figure out how to do this. I have experimented with v.clean, v.generalize, v.edit, and (converting to a thinned raster) r.grow, r.neighbors and even r.flow, but I can't find anything which will let me do this.

Can anyone point me to a tool that would do this?


You should use the tool v.clean with the option tool=snap and specify the correct thresh setting to snap the lines to the closest vertex. More details can be found here [1]

[1] http://grass.osgeo.org/gdp/html_grass64/v.clean.html

  • I tried that, but there are two problems: 1, it seems to snap to the first point found in threshold, not necessarily the closest. And 2, it also snaps ends which are already joined together. Am I doing something wrong? – aquavitae Sep 14 '12 at 12:21
  • if there aren't too many polygons to edit, you could the use vector digitizer in the wxgui grass.osgeo.org/grass64/manuals/html64_user/… – dmci Sep 14 '12 at 12:33
  • Only a few million... It definitely needs to be automatible. – aquavitae Sep 14 '12 at 13:37
  • ... then grass.osgeo.org/gdp/html_grass64/v.edit.html will be interesting. – markusN Sep 14 '12 at 14:32
  • I looked at v.edit, but can't see a way to do it with that either. – aquavitae Sep 26 '12 at 12:07

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.