[GRASS-user] v.db.update not working as expected

Uwe Fischer gisfisch at t-online.de
Wed May 25 03:24:51 PDT 2016


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!

 

 

best regards, Uwe

 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/grass-user/attachments/20160525/0c0fc62c/attachment-0001.html>


More information about the grass-user mailing list