1htmlmapdriver(1) Grass User's Manual htmlmapdriver(1)
2
3
4
6 htmlmapdriver
7
9 HTMLMAP driver - driver to create HTML image maps
10 (drivers)
11
13 The HTMLMAP driver allows the generation of HTML image maps for area
14 vector data. HTML image maps are used in conjunction with images to
15 provide unique URL targets for different portions of an image. The
16 HTMLMAP driver can create both client-side image maps embedded into
17 HTML files, or server-side image maps used by web server software.
18
19 Note that GRASS display commands that require the MOUSE will not work
20 correctly (or at all!)
21
22 Polygons can at most have 100 vertices (this limit imposed by HTML
23 image map formats, see GRASS_HTMLMAXPOINTS below.) The driver will
24 attempt to trim polygons that have more that 100 vertices by removing
25 vertices with the least amount of angle to the next vertice. Also, any
26 polygon that is entirely bounded by another polygon will be discarded.
27
28 Text written to the driver before polygons are used as the HREF tag for
29 all subsequent polygons written. All polygons that exist in a vector
30 map will have the same HREF tag.
31
32 The only GRASS display commands that should be used with this driver
33 are:
34 d.text - pass href information for resulting image maps. d.vect
35 - draw polygons from a vector map.
36
38 Environment variablesSeveral environment variables effect the operation
39 of HTMLMAP.
40 GRASS_WIDTH=xxx
41 the width of the image map (default is 640).
42 GRASS_HEIGHT=yyy
43 the height of the image map (default is 480).
44 GRASS_HTMLTYPE=type
45 the type of image mape to create (default is CLIENT):
46 CLIENT Netscape/IE client-side image map.
47 (NAME="map")
48 APACHE Apache/NCSA server-side image map.
49 RAW Raw url and polygon vertices ( url x1 y1
50 x2 y2 format with user supplied conversion program.
51 GRASS_HTMLFILE=filename
52 specifies the resulting file to store the html image map,
53 default is htmlmap. Files without absolute path names are writ‐
54 ten in the current directory where the driver was started.
55 Any existing file of the same name is overwritten without warn‐
56 ing.
57
58 GRASS_HTMLMINDIST=n
59 specifies the minimum distance in pixels that a point must
60 change from the previous point to keep in the list of vertices
61 for a polygon. The default is 2, which means that a point's x
62 and y difference from the previous point must change by a number
63 of pixels greater than this value. This parameter helps to
64 eliminate closely spaced points.
65 GRASS_HTMLMINBBOX=n
66 specifies the minimum bounding box dimensions to record a poly‐
67 gon as a clickable area. The default is 2, which means that a
68 polygon with a bounding box of less than this value is not
69 included. This parameter helps to eliminate polygons than are a
70 point or line.
71 GRASS_HTMLMAXPOINTS=n
72 specifies the maximum number of vertices included in a polygon's
73 clickable area. The default is 99. Some browsers can only
74 accomodate polygons of 100 vertices or less. The HTMLMAP driver
75 automatically ensures that a polygon is closed by making the
76 last point the same as the first point.
77
78 Typical usage
79
80 d.mon select=HTMLMAP
81 Display text strings (HREF's) and polygons
82
83 echo "http://www.no-such-place.net/area51/" | d.text
84 d.vect map=area51
85 echo "http://www.roswell-nm.net/little/green/men.html"
86 | d.text
87 d.vect map=roswell
88 Stop the driver when all polygon have been displayed. This will
89 cause a file named 'htmlmap' to be created in your current
90 directory.
91
92 d.mon stop=HTMLMAP
93 You will also want to create an image for your image map. Use
94 the PNG driver and other utilities to create .gif or .jpg files.
95 The following example is somewhat out of date and refers to
96 options available in GRASS 5.
97
98 # using previous GRASS_WIDTH & GRASS_HEIGHT
99 d.mon start=PNG
100 d.mon select=PNG
101 d.rast map=terrain
102 d.vect map=area51 fillcolor=white linecolor=blue
103 d.vect map=roswell fillcolor=yellow linecolor=blue
104 d.vect map=states color=green
105 d.vect map=roads color=black
106 d.mon stop=PNG
107 # make the region the same as the newly created cell
108 for ppm export
109 g.region save=saved.reg
110 g.region raster=D_cell
111 r.out.ppm -q input=D_cell output=alien.ppm
112 # use the netpbm utilities to create a gif (quantize if
113 needed)
114 ppmquant 128 <alien.ppm | ppmtogif >alien.gif
115 # assemble some html with the image and the image map
116 cat htmlmap
117 >>alien.html
118 # don't forget to reset your region
119 g.region region=saved.reg
120 # take a look and test it out
121 netscape file:`pwd`/alien.html &
122
123
125 HTMLMAP was adapted from the CELL driver in GRASS 4.3. Point-in-poly‐
126 gon test code was lifted from Randolph Franklin's web page, see
127 http://www.ecse.rpi.edu/Homepages/wrf/
128 http://www.ecse.rpi.edu/Homepages/wrf/research/geom/pnpoly.html
129
130 If you create an HTML file with two or more images and image maps, you
131 will need to edit the map names. The HTMLMAP driver creates its map
132 with the name map. A small sed script can easily change the map name:
133
134
136 PNG driver, PostScript driver, XDRIVER
137 d.frame, d.mon, d.rast, d.text, d.vect
138
139
140 Last changed: $Date: 2007-05-14 08:26:06 +0200 (Mon, 14 May 2007) $
141
142 Full index
143
144 © 2003-2008 GRASS Development Team
145
146
147
148GRASS 6.3.0 htmlmapdriver(1)