GRASS logo

Note: A new GRASS GIS stable version has been released: GRASS GIS 7.8, available here.
Updated manual page: here

HTML DISPLAY DRIVER

Table of contents

HTML display driver to create HTML image maps.

DESCRIPTION

The HTML driver allows the generation of HTML image maps for area vector data. HTML image maps are used in conjunction with images to provide unique URL targets for different portions of an image. The HTML driver can create both client-side image maps embedded into HTML files, or server-side image maps used by web server software.

Polygons can at most have 100 vertices (this limit imposed by HTML image map formats, see GRASS_RENDER_HTMLMAXPOINTS below.) The driver will attempt to trim polygons that have more that 100 vertices by removing vertices with the least amount of angle to the next vertice. Also, any polygon that is entirely bounded by another polygon will be discarded.

Text written to the driver before polygons are used as the HREF tag for all subsequent polygons written. All polygons that exist in a vector map will have the same HREF tag.

The only GRASS display commands that should be used with this driver are:

USAGE

Environment variables

The HTML driver can be enabled by setting GRASS_RENDER_IMMEDIATE variable, eg.
export GRASS_RENDER_IMMEDIATE=html
Several environment variables affect the operation of the HTML driver:

Example

Start up the driver
d.mon start=html
Display text strings (HREF's) and polygons
echo "http://www.no-such-place.net/area51/" | d.text
d.vect map=area51
echo "http://www.roswell-nm.net/little/green/men.html" | d.text
d.vect map=roswell
Stop the driver when all polygon have been displayed. This will cause a file named 'htmlmap' to be created in your current directory.
d.mon stop=html
You will also want to create an image for your image map. Use the PNG driver and other utilities to create .gif or .jpg files. The following example is somewhat out of date and refers to options available in GRASS 5.
# using previous GRASS_RENDER_WIDTH & GRASS_RENDER_HEIGHT
d.mon start=png
d.rast map=terrain
d.vect map=area51  fillcolor=white  linecolor=blue
d.vect map=roswell fillcolor=yellow linecolor=blue
d.vect map=states  color=green
d.vect map=roads   color=black
d.mon stop=png


# make the region the same as the newly created cell for ppm export
g.region save=saved.reg
g.region raster=D_cell
r.out.ppm -q input=D_cell output=alien.ppm

# use the netpbm utilities to create a gif (quantize if needed)
ppmquant 128 <alien.ppm |  ppmtogif >alien.gif 

# assemble some html with the image and the image map
echo '<html><body><img src="alien.gif" usemap="#map">' >alien.html
cat htmlmap                                           >>alien.html
echo '</body></html>'                                 >>alien.html
	
# don't forget to reset your region
g.region region=saved.reg

# take a look and test it out
netscape file:`pwd`/alien.html &

NOTES

HTML was adapted from the CELL driver in GRASS 4.3. Point-in-polygon test code was lifted from Randolph Franklin's web page, see

If you create an HTML file with two or more images and image maps, you will need to edit the map names. The HTML driver creates its map with the name map. A small sed script can easily change the map name:

sed -e 's/NAME="map"/NAME="foomap"/' < htmlmap > foomap.html

SEE ALSO

Cairo driver, PNG driver, HTML driver, variables

d.rast, d.vect, d.mon, d.erase, d.redraw

Last changed: $Date$


Note: A new GRASS GIS stable version has been released: GRASS GIS 7.8, available here.
Updated manual page: here

Main index | Topics index | Keywords index | Graphical index | Full index

© 2003-2020 GRASS Development Team, GRASS GIS 7.6.2dev Reference Manual