[GRASS-user] converting lines to polygons

Bryan Keith bryan at ideotrope.org
Thu Sep 23 18:45:49 EDT 2010

> On 09/23/2010 07:36 PM, Bryan Keith wrote:
>>> What OS are you on? what version of GRASS, and what GUI?
>> I'll answer these questions anyway, but I figured out the v.digit
>> problem
>> (see below).
>> Windows XP
>> GRASS 6.4.0
>> wxGUI
> So you'll be using the tcltk digitizer. (wxGui doesn't work yet in
> Windows)
>> OK, getting closer, I think.  The reason v.digit wasn't working was
>> because g.region was set incorrectly.  Now I can look at the various
>> maps
>> with v.digit and see the different colors of the lines and nodes.  In
>> the
>> meantime I created a very simple example and processed that map and was
>> able to get results that I expected.  So then I looked at the one that
>> worked and the one that didn't using v.digit to see what the differences
>> were.
>> The files that doesn't have all the areas that I expect has lines that
>> are
>> displayed orange (Boundary (1 area)) while the correct version has lines
>> that are display green (Boundary (2 areas)).  Could that be why I'm not
>> getting all the areas that I expect?  All the nodes look correct (no red
>> ones).  How do I fix this?  An option in v.clean?
> Orange boundaries are duplicates - overlapping lines - that GRASS
> topology doesn't allow.
> You should be able to get rid of these with:
> "v.clean in=... out=... tool=break,bpol,rmdupl"
> But I've never had good luck with this.
> The alternative that might work better for you:
> Re-import the layer from the original shapefiles (or where ever they
> came from) but use the "type=line" option to v.in.ogr. (No centroids
> will be created)
> Now do v.clean on this new GRASS vector, using tool=snap,break,rmdupl.
> Next use
> "v.type ... type=line,boundary"
> to convert the (cleaned) lines to boundaries, and then
> "v.centroids ... opt=add"
> to create area centroids inside each closed boundary.


Yes, thank you, that worked!  Here's what I did:

v.in.ogr -o dsn=C:\path\to\shapefile\test_ln.shp output=testm_ln type=line
v.clean input=testm_ln output=testmclean_ln tool=snap,break,rmdupl
v.type input=testmclean_ln output=testmclean_bnd type=line,boundary
v.centroids input=testmclean_bnd output=testmclean_py option=add

Thanks for all the help.


> --
> Micha Silver
> Arava Development Co. +972-52-3665918
> http://surfaces.co.il

More information about the grass-user mailing list