Ciao Stefan, thank you, I tried and it didn't give me any error but didn't update the column either...
On Wed, Jun 17, 2020 at 12:16 PM Stefan Blumentrath < stefan.blumentr...@nina.no> wrote: > Ciao Madi, > > > > You could use db.execute and do something like: > > db.execute sql="ALTER TABLE vectormap ADD COLUMN reclass_column TEXT; > > UPDATE vectormap SET reclass_column = CASE > > WHEN old_column = ' old value 1' THEN ' new value 1' > > WHEN old_column = ' old value 2' THEN ' new value 2' > > WHEN old_column = ' old value 3' THEN ' new value 3' > > ELSE ' new value 4' > > END; " > > > > Maybe worth adding as an (validated) example to the manual of db.execute ( > https://grass.osgeo.org/grass78/manuals/db.execute.html)… > > > > Cheers > > Stefan > > > > P.S.: I did not alidate the SQL syntax, but it should be roughly along > those lines… > > > > *From:* grass-user <grass-user-boun...@lists.osgeo.org> *On Behalf Of > *Margherita > Di Leo > *Sent:* onsdag 17. juni 2020 10:35 > *To:* GRASS user list <grass-user@lists.osgeo.org> > *Subject:* [GRASS-user] Reclassify a vector adding a column > > > > Hi, > > > > I need to reclassify a vector in the following way: based on a column of > type string I have to create a new column of type string based on certain > rules that I give upon the first column, and I thought it would be really > handy if I could do it like CASE WHEN... THEN ... > > I have tried to feed a similar rules file to v.reclass but this statement > is not recognised. How can I translate it? Furthermore, I would like to be > able to just add a reclass column rather than creating a new vector file, > is that possible? How? > > > > Thank you in advance > > > > Kind regards, > > > -- > > Margherita Di Leo > -- Margherita Di Leo
_______________________________________________ grass-user mailing list grass-user@lists.osgeo.org https://lists.osgeo.org/mailman/listinfo/grass-user