[GRASS-user] How to replace some vector & DB features, keep attributes

Ken Mankoff mankoff at gmail.com
Sun Jan 14 19:55:20 PST 2024


Hi,

I'd like to replace multiple vector lines with ID == 42 with one new one, and keep the attributes (date, year, name) from one of the replaced/removed lines.

I'm able to create my one new line with:

echo "L 2 1
     -273157 -994455
     -255458 -989423
     1 100000" | v.edit -n tool=add map=test input=-

I'm not sure how to copy over the relevant attributes from one of the lines (first, last, doesn't matter) that has the relevant ID.

Once I do that, I think I know how to delete the lines I don't want, but I'm not sure I'm doing it correct. It seems I have to run two commands to delete the lines from both the vectors (when displaying) and the database (when querying). I'm doing this:

v.edit map=test tool=delete where="ID == 42"
db.execute sql="DELETE FROM test WHERE ID == 42"

Can anyone help with the middle step?

Thanks,

  -k.


More information about the grass-user mailing list