1
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
4
<TITLE>HTMLMAP driver</TITLE>
5
<META http-equiv=Content-Type content="text/html; charset=iso-8859-1">
6
<link rel="stylesheet" href="grassdocs.css" type="text/css">
10
<img src="grass_logo.png" alt="GRASS logo"><hr align=center size=6 noshade>
14
<EM><B>HTMLMAP driver</B></EM> - driver to create HTML image maps.
15
<BR><EM>(drivers)</EM>
19
The HTMLMAP driver allows the generation of HTML image maps
20
for area vector data. HTML image maps are used in conjunction with images to
21
provide unique URL targets for different portions of an image. The HTMLMAP
22
driver can create both client-side image maps embedded into HTML files, or
23
server-side image maps used by web server software.
25
Note that GRASS display commands that require the MOUSE will not work
26
correctly (or at all!)
28
Polygons can at most have 100 vertices (this limit imposed by HTML image map
29
formats, see <B>GRASS_HTMLMAXPOINTS</B> below.) The driver will attempt to
30
trim polygons that have more that 100
31
vertices by removing vertices with the least amount of angle to the next
32
vertice. Also, any polygon that is entirely bounded by another polygon will be
35
Text written to the driver before polygons are used as the HREF tag for all
36
subsequent polygons written. All polygons that exist in a vector map will have
39
The only GRASS display commands that should be used with this driver are:
41
<LI><a href="d.text.html">d.text</A>
42
- pass href information for resulting image maps.</LI>
43
<LI><a href="d.vect.html">d.vect</A>
44
- draw polygons from a vector map.</LI>
49
<H3>Environment variables</H3>Several environment variables effect the operation
53
<LI><B>GRASS_WIDTH=xxx</B><BR>
54
the width of the image map (default is 640).
56
<LI><B>GRASS_HEIGHT=yyy</B><BR>
57
the height of the image map (default is 480).
59
<LI><B>GRASS_HTMLTYPE=type</B><BR>
60
the type of image mape to create (default is CLIENT):
62
<DD><TT><B>CLIENT</B></TT> Netscape/IE client-side image map.
64
<DD><TT><B>APACHE</B></TT> Apache/NCSA server-side image
66
<DD><TT><B>RAW</B></TT> Raw url
67
and polygon vertices ( <I>url x1 y1 x2 y2
68
..... </I>), suitable for conversion to CERN server format, or any other
69
format with user supplied conversion program.</DD>
72
<LI><B>GRASS_HTMLFILE=filename</B><BR>
73
specifies the resulting file to store
74
the html image map, default is <tt>htmlmap</tt>. Files without absolute path
75
names are written in the current directory where the driver was started.
77
<em>Any existing file of the same name is overwritten without
80
<LI><B>GRASS_HTMLMINDIST=n</B><BR>specifies the minimum distance in pixels
81
that a point must change from the previous point to keep in the list of
82
vertices for a polygon. The default is <tt>2</tt>, which means that a
83
point's x and y difference from the previous point must change by a number
84
of pixels greater than this value. This parameter helps to eliminate
85
closely spaced points.
87
<LI><B>GRASS_HTMLMINBBOX=n</B><BR>specifies the minimum bounding box
88
dimensions to record a polygon as a clickable area.
89
The default is <tt>2</tt>, which means that a polygon with a bounding box
90
of less than this value is not included. This parameter helps to eliminate
91
polygons than are a point or line.
93
<LI><B>GRASS_HTMLMAXPOINTS=n</B><BR>specifies the maximum number of
94
vertices included in a polygon's clickable area.
95
The default is <tt>99</tt>. Some browsers can only accommodate polygons of
96
100 vertices or less. The HTMLMAP driver automatically ensures that a
97
polygon is closed by making the last point the same as the first
101
<H3>Typical usage</H3>
103
<LI>Start up the driver
104
<DIV class="code"><PRE>
108
<LI>Display text strings (HREF's) and polygons
109
<DIV class="code"><PRE>
110
echo "http://www.no-such-place.net/area51/" | d.text
112
echo "http://www.roswell-nm.net/little/green/men.html" | d.text
115
<LI>Stop the driver when all polygon have been displayed. This will cause a file
116
named 'htmlmap' to be created in your current directory.
117
<DIV class="code"><PRE>
120
<LI>You will also want to create an image for your image map. Use the PNG
121
driver and other utilities to create .gif or .jpg files.
122
<i>The following example is somewhat out of date and refers to options
123
available in GRASS 5.</i>
124
<DIV class="code"><PRE>
125
# using previous GRASS_WIDTH & GRASS_HEIGHT
129
d.vect map=area51 fillcolor=white linecolor=blue
130
d.vect map=roswell fillcolor=yellow linecolor=blue
131
d.vect map=states color=green
132
d.vect map=roads color=black
135
# make the region the same as the newly created cell for ppm export
136
g.region save=saved.reg
137
g.region raster=D_cell
138
r.out.ppm -q input=D_cell output=alien.ppm
140
# use the netpbm utilities to create a gif (quantize if needed)
141
ppmquant 128 <alien.ppm | ppmtogif >alien.gif
143
# assemble some html with the image and the image map
144
echo '<html><body><img src="alien.gif" usemap="#map">' >alien.html
145
cat htmlmap >>alien.html
146
echo '</body></html>' >>alien.html
148
# don't forget to reset your region
149
g.region region=saved.reg
151
# take a look and test it out
152
netscape file:`pwd`/alien.html &
159
HTMLMAP was adapted from the CELL driver in GRASS 4.3.
160
Point-in-polygon test code was lifted from Randolph Franklin's web page, see
162
<LI><a href="http://www.ecse.rpi.edu/Homepages/wrf/">http://www.ecse.rpi.edu/Homepages/wrf/</A></LI>
163
<LI><a href="http://www.ecse.rpi.edu/Homepages/wrf/research/geom/pnpoly.html">http://www.ecse.rpi.edu/Homepages/wrf/research/geom/pnpoly.html</A></LI>
167
If you create an HTML file with two or more images and image maps, you will
168
need to edit the map names. The HTMLMAP driver creates its map with the name
169
<tt>map</tt>. A small sed script can easily change the map name:
172
sed -e 's/NAME="map"/NAME="foomap"/' < htmlmap > foomap.html
178
<a href="displaydrivers.html">Display drivers</a>
180
<a href="pngdriver.html">PNG driver</A>,
181
<a href="psdriver.html">PostScript driver</A>,
182
<a href="xdriver.html">XDRIVER</A>
184
<A href="d.mon.html">d.mon</A>,
185
<a href="d.text.html">d.text</A>,
186
<a href="d.vect.html">d.vect</A>
190
<i>Last changed: $Date: 2010-01-20 14:26:08 +0100 (Wed, 20 Jan 2010) $</i>