[GRASS-user] v.db.update not working as expected
Moritz Lennert
mlennert at club.worldonline.be
Wed May 25 09:27:21 PDT 2016
Le Wed, 25 May 2016 12:24:51 +0200,
"Uwe Fischer" <gisfisch at t-online.de> a écrit :
> I have a dataset of boundaries and centroids where sometimes
> centroids are missing because of digitizing errors. I tried to create
> new centroids using v.centroids, but that did not work (please see my
> message from May 12.)
>
>
>
> Then I tried to use v.category with options type=area and option=add
> along with cat=9000, and that works. I get new centroids with the
> desired cat values (up from 9000). The rest of the columns for the
> new centroids show NULL. Funny thing about the new centroids: they
> show up when viewing the map in QGIS or when using d.vect, but they
> are not visible when listing the table using db.select. I don't
> understand that.
>
>
>
> Now, I need to transfer the category values of the new centroids to
> another existing column, but that doesn't work. Here are the commands
> I tried one at a time:
>
>
>
> v.db.update map=inputmap, column='myCol', query_column='cat',
> where="cat >= 9000"
>
>
>
> db.execute sql="UPDATE inputmap SET myCol = cat WHERE cat >= 9000")
>
>
>
> Both commands don't work as expected. The values in "myCol" for the
> new centroids stay NULL, no matter what. When I set another filter
> (for example, cat >1), they both work fine for those centroids that
> were existing from the beginning - but not for the new ones. I also
> tried to insert random integer values into "myCol", but this also
> works only for the old centroids. The new ones don't accept changes.
>
>
>
> At least it means we have no syntax error or something like that.
>
>
>
> Any ideas what's wrong? Why are the new cents not completely
> accepted? Thank you very much!
>
There is a difference between centroids in the map and the integration
of cat values in the table.
v.category / v.centroid do not add cat values to the table.
As the v.category man page says: "Use v.to.db to upload related
categories to a linked attribute table."
Moritz
More information about the grass-user
mailing list