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