[GRASS-user] vector to rast including dbf

Hamish hamish_nospam at yahoo.com
Wed Mar 21 18:22:55 EDT 2007


antonio rodriguez wrote:
> I have several vector (lines,points, poly) maps connected to their 
> respective .dbf files (airports, roads, administrative categories).
> How  do I can transform them to raster maps having the same
> categories. It's to say, when I do d.what.rast I would like to see
> the label of certain road.

v.to.rast use=cat

then create a $MAPSET/cats/$MAPNAME file with the labels in it.

I am not sure of an automatic way to do that (maybe someone else has an
idea), but it is a simple text file and you can get 98% of the way there
with v.db.select and the 'tr'ade unix tool.

GRASS> v.db.select map=roads | tr '|' ':'
cat:label
0:no data
1:interstate
2:primary highway, hard surface
3:secondary highway, hard surface
4:light-duty road, improved surface
5:unimproved road



See Spearfish dataset's spearfish/PERMANENT/cats/roads file for an idea
of what the raster cats file needs to look like:
# 5 categories
Spearfish Database Roads at 1:24000

0.00 0.00 0.00 0.00
0:no data
1:interstate
2:primary highway, hard surface
3:secondary highway, hard surface
4:light-duty road, improved surface
5:unimproved road



Hamish




More information about the grass-user mailing list