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

Maris Nartiss maris.gis at gmail.com
Mon Jan 15 02:10:43 PST 2024


Hi Ken,
v.edit tool=catadd/catdel is the thing you are looking for. Delete old
geometry, delete category of new geometry (if there is one), set old
cat value to the new geometry.

Good luck,
M.

pirmd., 2024. g. 15. janv., plkst. 04:56 — lietotājs Ken Mankoff via
grass-user (<grass-user at lists.osgeo.org>) rakstīja:
>
> 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.
> _______________________________________________
> grass-user mailing list
> grass-user at lists.osgeo.org
> https://lists.osgeo.org/mailman/listinfo/grass-user


More information about the grass-user mailing list