1htmldriver(1) GRASS GIS 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Â
51 y1Â x2Â y2Â .....), suitable for conversion to CERN server
52 format, or any other format with user supplied conversion pro‐
53 gram.
54
55 · GRASS_RENDER_FILE=filename
56 specifies the resulting file to store the html image map,
57 default is htmlmap. Files without absolute path names are writ‐
58 ten in the current directory where the driver was started.
59 Any existing file of the same name is overwritten without warn‐
60 ing.
61
62 · GRASS_RENDER_HTMLMINDIST=n
63 specifies the minimum distance in pixels that a point must
64 change from the previous point to keep in the list of vertices
65 for a polygon. The default is 2, which means that a point’s x
66 and y difference from the previous point must change by a num‐
67 ber of pixels greater than this value. This parameter helps to
68 eliminate closely spaced points.
69
70 · GRASS_RENDER_HTMLMINBBOX=n
71 specifies the minimum bounding box dimensions to record a poly‐
72 gon as a clickable area. The default is 2, which means that a
73 polygon with a bounding box of less than this value is not
74 included. This parameter helps to eliminate polygons than are a
75 point or line.
76
77 · GRASS_RENDER_HTMLMAXPOINTS=n
78 specifies the maximum number of vertices included in a poly‐
79 gon’s clickable area. The default is 99. Some browsers can
80 only accommodate polygons of 100 vertices or less. The HTMLMAP
81 driver automatically ensures that a polygon is closed by making
82 the last point the same as the first point.
83
84 Example
85 Start up the driver
86 g.region vector=zipcodes_wake
87 d.mon start=html
88 Display text strings (HREF’s) and polygons
89 echo "https://en.wikipedia.org/wiki/Raleigh,_North_Carolina" | d.text
90 d.vect map=zipcodes_wake where="ZIPNAME = ’RALEIGH’"
91 echo "https://en.wikipedia.org/wiki/Cary,_North_Carolina" | d.text
92 d.vect map=zipcodes_wake where="ZIPNAME = ’CARY’" fill_color=180:200:210
93 Stop the driver once all polygon have been displayed. This will create
94 a file named ’htmlmap’ in your current directory:
95 d.mon stop=html
96 You will also want to create an image for your image map. Use the PNG
97 driver and other utilities to create .gif or .jpg files. The following
98 example is somewhat out of date and refers to options available in
99 GRASS 5.
100 # using previous GRASS_RENDER_WIDTH & GRASS_RENDER_HEIGHT
101 d.mon start=png
102 d.rast map=terrain
103 d.vect map=area51 fillcolor=white linecolor=blue
104 d.vect map=roswell fillcolor=yellow linecolor=blue
105 d.vect map=states color=green
106 d.vect map=roads color=black
107 d.mon stop=png
108 # make the region the same as the newly created cell 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 needed)
113 ppmquant 128 <alien.ppm | ppmtogif >alien.gif
114 # assemble some html with the image and the image map
115 echo ’<html><body><img src="alien.gif" usemap="#map">’ >alien.html
116 cat htmlmap >>alien.html
117 echo ’</body></html>’ >>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
124 HTML was adapted from the CELL driver in GRASS 4.3. Point-in-polygon
125 test code was lifted from Randolph Franklin’s web page, see
126
127 · http://www.ecse.rpi.edu/Homepages/wrf/
128
129 · http://www.ecse.rpi.edu/Homepages/wrf/research/geom/pnpoly.html
130
131 If you create an HTML file with two or more images and image maps, you
132 will need to edit the map names. The HTML driver creates its map with
133 the name map. A small sed script can easily change the map name:
134 sed -e ’s/NAME="map"/NAME="foomap"/’ < htmlmap > foomap.html
135
137 Cairo driver, PNG driver, HTML driver, variables
138 d.rast, d.vect, d.mon, d.erase, d.redraw
139
140 Main index | Topics index | Keywords index | Graphical index | Full
141 index
142
143 © 2003-2020 GRASS Development Team, GRASS GIS 7.8.5 Reference Manual
144
145
146
147GRASS 7.8.5 htmldriver(1)