tinting orthographic images

Rebecca Scheckler rebecca at atum.ento.vt.edu
Tue Jun 28 11:47:15 EDT 1994

With the help of a sample shell program from Glen Lawson, I have been able to tint fields of an orthographic image with colors representing crops.  Now I am trying to tint soils as to capability class. While the proceudre seems to work, the colors are not coming out as specified.  I am wondering if the problem results from the categories of capability classes being discontinuous. My code follows. Please let me know if you have successfully resampled, rescaled and then patched categories that were discontinuous. I am working on a sun sparc 2 running sunos 4.1.3 and grass 4.1. The script is csh. 
## lets see if we can tint soil classes
#use number of soil capability classes
set numcats=8

echo "The tint map, $tint, has $numcats soil categories."

#######do fields- loop through soil categories
set catno = 1
while ($catno <= $numcats)

r.reclass in=$tint out=MASK$catno << EOF
$catno = $catno

g.copy rast=MASK$catno,MASK >/dev/null
echo "resampling capability class  $catno ....."
r.resample in=$ortho out=T_ORTHO$catno
g.remove rast=MASK,MASK$catno >/dev/null

#target range
if ($catno == 1) then
    set rangeBegin = 1
else @ rangeBegin = $catno * 40 - 39

  @ rangeEnd = $catno * 40 

r.rescale in=T_ORTHO$catno out=T_ORTHO$catno.1 to=$rangeBegin,$rangeEnd
@ catno += 1
#end loop through fields

####patching maps
set ct = 1
set pmaps =  T_ORTHO1.1
@ catno = $numcats 
while($ct < $catno)
  @ ct += 1
  echo "ct = $ct "
  set pmaps=$pmaps,T_ORTHO$ct.1

echo "patching maps together......"
r.patch  in=$pmaps out=soilsNE

set ct = 1
while ($ct <= $numcats + 1)
g.remove rast=T_ORTHO$ct,T_ORTHO$ct.1 >/dev/null
@ ct += 1

### rescale background and patch to tinted fields
if (-e $LOCATION/cats/rescaleOrtho) then
  ### DO NOTHING ###
r.rescale in=bridgene out=rescaleOrtho to=361,400

r.patch in=soilsNE,rescaleOrtho, out=nresultSoilsNE


#set proper colors for soil capability classes
cat ${colorrules} | r.colors map=nresultSoilsNE co=rules

#display tinted soils/home/grass4.1data
d.rast nresultSoilsNE
d.vect 16.nw color=black
d.vect streams.16 color=blue
d.vect soils.16 color=white

More information about the grass-dev mailing list