Trying to convert lines to polygons

Michel Wurtz - LTE mw at engees.u-strasbg.fr
Mon Feb 22 04:59:19 EST 1999


Juan Bañuls wrote:
> 
> Hello!!!
> First I would like to thank you for your time and the support you're
> giving to GRASS. Well, I've a problem: I'm trying to convert the lines
> of a dxf file into areas. In order to get it I've probed the
> v.line2area.sh script, but it does not work as I want since some areas
> are not detected, and I cannot give any parameters interactively in
> order to improve the translation.
> Also I've proved to:
>         1- Import the dxf file with v.in.dxf to a ASCII vector file,
>         2- Replace all the L's by A's
>         3- Convert the ASCII vector file to a GRASS VECTOR one.
> I have run v.support with several snapping values but (in the best case)
> I've got the same results obtained with v.line2area.sh. So I don´t know
> how to tell GRASS to recognize all the areas contained in the dxf. Of
> course I have probed to filter the file with v.clean, v.trim... but the
> only way I've found of getting the right results with GRASS has been
> cleaning the dxf before with AutoCAD Map :-( and doing v.line2area.sh.
> As you can suppose this is a very bad solution, because AutoCAD Map is
> very slow, and I don't want to buy it because it's expensive.
> 
> Have you any idea?

The areas you create are not labelled (means that v.to.rast will give
you an empty file).  Snapping doesn't help.  Labelling is done via the
dig_att file : an entry for each area or line to be labelled made as
following for an area :

A xxxxxx yyyyyy nn

A means area (L for line), xxxxx and yyyyyy are the coordinates of the
label point (inside the area), and nn is the area number (> 0).

Try to use v.digit after running v.support.  There is some command
to show unlabelled areas.  You can label each area interactively.
If some areas cannot be labelled, look at the nodes around them (and
zoom)
If there is some green dots, that's mean that a line doesn't match
any other. You can snap manualy lines together, solving the unclosed
polygon problem. After that rerun v.support to label area, and v.to.rast
will work.

If you have some labels in dxf, you can import them in the dig_att file
with respect to the format showed above (v.digit is sometimes boring :-)

-- 
Michel Wurtz    ENGEES - Laboratoire Territoires & Environnement
                1, quai Koch - BP 1039, F-67070 STRASBOURG cedex
                Tel: +33 03.88.24.82.45  Fax: +33 03.88.37.04.97



More information about the grass-user mailing list