# this is a sample shell script that uses the HTMLMAP driver to create
# image maps. The vector files were created with my s.to.poly.sh script
# from site data.
export GRASS_WIDTH=600
export GRASS_HEIGHT=600
export GRASS_HTMLFILE=mymap
d.mon start=HTMLMAP
d.mon select=HTMLMAP
jsbeg="javascript:alert('Look out! You might be abducted by"
jsend="')"
# create the image map for alien sightings
echo "$jsbeg Little Green Men $jsend" | d.text ; d.area map=green_men
echo "$jsbeg Acid-Dripping Roaches $jsend" | d.text ; d.area map=acid_roaches
echo "$jsbeg Sexy Martian Babes $jsend" | d.text ; d.area map=martians
echo "$jsbeg Slender Bug-eyed Aliens $jsend" | d.text ; d.area map=bug_eyed
d.mon stop=HTMLMAP
# now create the corresponding image
d.mon start=CELL
d.mon select=CELL
d.rast map=colorado
d.area map=green_men fillcolor=blue
d.area map=acid_roaches fillcolor=yellow
d.area map=martians fillcolor=orange
d.area map=bug_eyed fillcolor=red
d.mon stop=CELL
# convert the CELL file into a gif, by way of ppm
g.pushregion.sh
g.region raster=D_cell
r.out.ppm -q input=D_cell output=aliens.ppm
ppmquant 128 aliens.gif
rm -f aliens.ppm
g.popregion.sh
# now generate the html
echo 'Alien sightings in Colorado
' >htmlmap.html
echo '
Click on a colored region for possible types
' >>htmlmap.html
echo 'see source file' >>htmlmap.html
echo '
' >>htmlmap.html
cat mymap >>htmlmap.html
echo '
' >>htmlmap.html
echo '' >>htmlmap.html
# end