hello i would like to rasterize a vector layer i guess within: v.to.rast_______________________________________________ grass-user mailing list [hidden email] http://lists.osgeo.org/mailman/listinfo/grass-user |
On Thu, Sep 4, 2014 at 4:56 PM, christophe joey
<[hidden email]> 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 _______________________________________________ grass-user mailing list [hidden email] http://lists.osgeo.org/mailman/listinfo/grass-user |
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:thank you On Thu, Sep 4, 2014 at 7:00 PM, Markus Neteler <[hidden email]> wrote:
_______________________________________________ grass-user mailing list [hidden email] http://lists.osgeo.org/mailman/listinfo/grass-user |
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 |
In reply to this post by christophe
On Fri, Sep 5, 2014 at 3:00 PM, christophe joey
<[hidden email]> 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 ? 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 _______________________________________________ grass-user mailing list [hidden email] http://lists.osgeo.org/mailman/listinfo/grass-user |
Free forum by Nabble | Edit this page |