hello
i would like to rasterize a vector layer i guess within: v.to.rast
but the type of the column to use in the rasterization is string not numeric_._
is it possible to do it in grass 6.4 ?
thank you
hello
i would like to rasterize a vector layer i guess within: v.to.rast
but the type of the column to use in the rasterization is string not numeric_._
is it possible to do it in grass 6.4 ?
thank you
On Thu, Sep 4, 2014 at 4:56 PM, christophe joey
<christophe0joey@gmail.com> wrote:
hello
i would like to rasterize a vector layer i guess within: v.to.rast
but the type of the column to use in the rasterization is string not
numeric.is it possible to do it in grass 6.4 ?
Yes.
- use v.db.addcol to add a new numeric column
- then cast the string numbers to numeric with v.db.update:
http://grass.osgeo.org/grass64/manuals/v.db.update.html
--> see last example (that's for the SQLite or other true SQL
drivers only, not the DBF backend)
Markus
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
On Thu, Sep 4, 2014 at 7:00 PM, Markus Neteler <neteler@osgeo.org> wrote:
On Thu, Sep 4, 2014 at 4:56 PM, christophe joey
<christophe0joey@gmail.com> wrote:hello
i would like to rasterize a vector layer i guess within: v.to.rast
but the type of the column to use in the rasterization is string not
numeric.is it possible to do it in grass 6.4 ?
Yes.
- use v.db.addcol to add a new numeric column
- then cast the string numbers to numeric with v.db.update:
http://grass.osgeo.org/grass64/manuals/v.db.update.html
→ see last example (that’s for the SQLite or other true SQL
drivers only, not the DBF backend)Markus
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 Cso, 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:
typenumeric)
- 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
labelcolumn=Type)
-----
best regards
Helmut
--
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.
On Fri, Sep 5, 2014 at 3:00 PM, christophe joey
<christophe0joey@gmail.com> 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 Cso, i have to rasterize it using the type field wich is not numeric.
How can i do it ?
You can either do it as Helmut suggested or take a look at Example 3
http://grass.osgeo.org/grass70/manuals/v.to.rast.html#examples
3. Convert a vector polygon map to raster including descriptive labels
Markus