[GRASS-user] v.centroids messing up attributes of imported boundaries

Matthias Loeks matthias at loeks.net
Fri Aug 21 08:47:02 PDT 2015


Hi all,

My input data is a GeoJSON file with 88 lines, which represent closed 
entities (the data originally comes from a CAD file).
Now I'd like to build closed polygons out of these lines using GRASS and 
export the polygons as GeoJSON.

The import using v.in.ogr basically works fine. I use the type=boundary 
and snap=1 options in order to clean the input and build the closed 
boundaries, which I understand can be expressed as/converted to polygons.

When I try to export the cleaned and polygonized data using v.out.ogr, 
the tool crashes with a segfault. I cannot see the reason why it is 
failing, even with --verbose flag active.

If I execute v.centroids as an intermediate step, the export afterwards 
succeeds. However, v.centroids seems to mess up the attributes linked to 
the imported data. While the relations were correct in the imported map, 
they are mixed up entirely after the v.centroids command.

My questions:

1) Why does v.out.ogr crash if I use it to export plain boundaries that 
were just imported before?
2) If it fails because it requires the data to have centroids, shouldn't 
these centroids of the boundaries already have been built during 
v.in.ogr? (At least the output suggests this...) Why does it need 
another explicit call to v.centroids?
3) Why does v.centroids mix up the attribute table, losing the correct 
link between the imported geometries and their attributes?

I guess my problem is somehow related to the categories and how they are 
changed by v.centroids (which is basically v.category option=add).
Still I cannot see the exact problem, since my lack of knowledge about 
how GRASS - and in particular the categories - actually work.

Any help on this is greatly appreciated! I can provide the data I've 
used if needed.

Many thanks in advance and best regards,
Matthias


More information about the grass-user mailing list