[GRASSLIST:629] Re: Some questions about contours.

H Bowman hamish_nospam at yahoo.com
Sun Jul 6 01:44:45 EDT 2003


> A question.  I want to colourize the contour areas, i.e. Have the
> lower elevations in green, middle elevations in yellow, and
> mountainous regions in brown.  How would I go about doing this.  The
> contour layers were set up in 10s (10, 30, 70, etc.), 20s (20, 40, 60,
> 80, 120, etc.) and 50s (50, 100, 150, etc.).  I also have spot
> heights, and the text labels.

This should give you the general idea:

v.to.rast input=contour output=contours
s.to.rast in=height_pnt output=height_pnt
 # s.to.rast not v.to.rast  is to get cat labels right
r.patch in=height_pnt,contours out=land.skel

# need to do coast seperately as you can't have a category 0, 
# and v.to.rast works on category.
v.to.rast in=coastline.plus1m out=coastln.plus1m 

r.patch in=land.skel,coastln.plus1m out=land.skel_plus1m
g.remove rast=coastln.plus1m,contours,height_pnt,land.skel

# mask is important for speed on area without contours! (ie sea)
r.mapcalc MASK="if(isnull(sea_mask),1,null())"

r.surf.contour -f in=land.skel_plus1m out=land_plus1m
g.remove MASK
# then fill the sea with flat 1m surface
r.mapcalc land_plus1m="if(isnull(sea_mask),land_plus1m,1)"
r.colors map=land_plus1m color=rainbow


Use 'r.colors color=rules' to set up green/yellow/brown color map
 (maybe take from s.surf.rst?)



good luck,
Hamish




More information about the grass-user mailing list