[GRASS-user] rasterize vector layer (string column)

Helmut Kudrnovsky hellik at web.de
Fri Sep 5 11:37:23 PDT 2014

christophe wrote
> thank you markus for the reply
> well, in vector layer i don't have a field containing numbers in string
> field, here is my attribute table:
> objectID   Type
> 1               A
> 2               A
> 3               B
> 4               A
> 5               C
> so, i have to rasterize it using the type field wich is not numeric.
> How can i do it ?
> thank you

something like this should do it:

- use v.db.addcol to add a new numeric column (e.g. column name:

- use v.db.update with WHERE conditions to 'translate' e.g. all A to 1, all
B to 2 and so on (e.g. v.db.update map=yourvectordata column=typenumeric
value=1 where="Type =  A", v.db.update map=yourvectordata column=typenumeric
value=2 where="Type = B", etc.)

- use v.to.rast to rasterize the vector and label your raster map with the
type information (e.g. v.to.rast input=yourvectordata column=typenumeric

best regards
View this message in context: http://osgeo-org.1560.x6.nabble.com/rasterize-vector-layer-string-column-tp5160150p5160418.html
Sent from the Grass - Users mailing list archive at Nabble.com.

More information about the grass-user mailing list