vectors: lines to polygons (2)

David D Gray ddgray at
Thu Jun 3 16:36:04 EDT 1999

Agustin Lobo wrote:

> I have imported a vegetation map of Europe.
> It seems that it was digitized as LINES, not
> as polygons, which is not very useful for a vegetation map.
> Therefore, I have now a vector map in which the lines should be
> appended to make polygons. I've checked the ascii
> file and it is not just
> that each polygon is made out of one single line
> (i.e., that the last point is not equal to the
> first one), so it's not just a question of
> copying the first point at the end of the polygon an
> replacing "L" by "A" in the ascii vector format.
> It is more complicated as lines have to be combined
> into polygons.
> The question (and I suspect the answer...):
> is there an automatic procedure to combine the
> lines into polygons?, i.e., if we have:
>  B     A    E
>  B     C    E
>  D     C    F
>  (where each letter is a line)
>  transform to  2 polygons
>  Thanks (to both mailing list users and mailing list keepers)
>  Agus


I'm doing similar work just now with digitised polygons imported as

I think you will need to perform the following stages:

1.  Convert the lines to area edges with . It runs
interactively at the console.

2.  [Maybe] Just check in v.digit to make sure all the lines are
correctly snapped. Snapped nodes are a different color from unsnapped
(red usually)

3. Use v.trim to remove the excess nodes - ie so that each area edge is
just a single line. Run this with the threshold value set to 0. This
creates a new vector file.

  ( I think this is the critical stage you are looking for   :)

4. Run on the new file -

and then the topology should be correct, and you can label the polygons

Hopes this helps

D Gray

More information about the grass-user mailing list