[GRASS-dev] Vlib: how to delete an object from a GRASS vector map

Markus Neteler neteler at osgeo.org
Sat Aug 23 11:14:35 EDT 2008


On Thu, Aug 21, 2008 at 6:54 PM, Benjamin Ducke
<benjamin.ducke at oxfordarch.co.uk> wrote:
> Dear all,
>
> I am struggling to understand how to delete an object, including its
> attached attributes, from a GRASS vector map.
>
> I open the map with:
>
> Vect_open_update ( &Map, MAPS[i].tempname, mapset );
>
> Then I find the category IDs of the objects I want to delete and then I
> do:
>
> Vect_delete_line ( &Map, cat );
> Vect_field_cat_del ( Cats, field, cat );
>
> and Vect_close() after the work is done.
>
> However, the next module I try to run on the modified map
> throws an error:
>
> ERROR: Attempt to read dead line [282]
>
> How do I eliminate dead lines from the map?

In vector/v.digit/line.c I have found:

            /* delete lines with less than two points */
            Vect_delete_line(&Map, el->line);
            for (i = 0; i < el->Cats->n_cats; i++) {
                check_record(el->Cats->field[i], el->Cats->cat[i]);
            }

Might be something like this...

Markus


More information about the grass-dev mailing list