1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135
|
<H2>NAME</H2>
<EM><B>HTMLMAP driver</B></EM> - driver to create HTML image maps
<BR><EM>(drivers)</EM>
<H2>DESCRIPTION</H2>
The HTMLMAP 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 HTMLMAP
driver can create both client-side image maps embedded into HTML files, or
server-side image maps used by web server software.
<P>Note that GRASS display commands that require the MOUSE will not work
correctly (or at all!)
<P>Polygons can at most have 100 vertices (this limit imposed by HTML image map
formats, see <B>GRASS_HTMLMAXPOINTS </B> 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.
<P>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 file will have
the same HREF tag.
<P>The only GRASS display commands that should be used with this driver are:
<UL>
<LI><a href="d.text.html">d.text</A>
- pass href information for resulting image maps.
<LI><a href="d.vect.html">d.vect</A>
- draw polygons from a vector file. </LI></UL><BR>
<H2>USAGE</H2>
<H3>Environment variables</H3>Several environment variables effect the operation
of HTMLMAP.
<UL>
<LI><B>GRASS_WIDTH=xxx</B><BR>the width of the image map (default is
640).<BR><BR>
<LI><B>GRASS_HEIGHT=yyy</B><BR>the height of the image map (default is
480).<BR><BR>
<LI><B>GRASS_HTMLTYPE=type</B><BR>the type of image mape to create (default is
CLIENT):
<UL>
<DD><TT><B>CLIENT</B></TT> Netscape/IE client-side image map.
(NAME="map")<BR>
<DD><TT><B>APACHE</B></TT> Apache/NCSA server-side image
map.<BR>
<DD><TT><B>RAW</B></TT> Raw url
and polygon vertices ( <I>url x1 y1 x2 y2
..... </I>), suitable for conversion to CERN server format, or any other
format with user supplied conversion program. </DD></UL><BR>
<LI><B>GRASS_HTMLFILE=filename</B><BR>specifies the resulting file to store
the html image map, default is <B>htmlmap</B>. Files without absolute path
names are written in the current directory where the driver was started.
<BR><B><EM>Any existing file of the same name is overwritten without
warning.</EM></B><BR><BR> </LI>
<LI><B>GRASS_HTMLMINDIST=n</B><BR>specifies the minimum distance in pixels
that a point must change from the previous point to keep in the list of
vertices for a polygon. The default is <B>2</B>, which means that a
point's x and y difference from the previous point must change by a number
of pixels greater than this value. This parameter helps to eliminate
closely spaced points. <BR><BR></LI>
<LI><B>GRASS_HTMLMINBBOX=n</B><BR>specifies the minimum bounding box
dimensions to record a polygon as a clickable area.
The default is <B>2</B>, which means that a polygon with a bounding box
of less than this value is not included. This parameter helps to eliminate
polygons than are a point or line. <BR><BR></LI>
<LI><B>GRASS_HTMLMAXPOINTS=n</B><BR>specifies the maximum number of
vertices included in a polygon's clickable area.
The default is <B>99</B>. Some browsers can only accomodate polygons of
100 vertices or less. The HTMLMAP driver automatically ensures that a
polygon is closed by making the last point the same as the first
point. <BR><BR></LI></UL>
<P>
<H3>Typical usage</H3>
<NL>
<LI>Start up the driver<BR><PRE> d.mon start=HTMLMAP
d.mon select=HTMLMAP
</PRE>
<LI>Display text strings (HREF's) and polygons<BR><PRE> 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
</PRE>
<LI>Stop the driver when all polygon have been displayed. This will cause a file
named 'htmlmap' to be created in your current directory.<BR><PRE> d.mon stop=HTMLMAP
</PRE>
<LI>You will also want to create an image for your image map. Use the CELL
driver and other utilities to create .gif, .jpg, or .png files<BR><PRE> # using previous GRASS_WIDTH & GRASS_HEIGHT
d.mon start=CELL
d.mon select=CELL
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=CELL
# 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 &
</PRE><BR></NL>
<H2>NOTES</H2>
HTMLMAP was adapted from the CELL driver in GRASS 4.3.
Point-in-polygon test code was lifted from Randolph Franklin's web page, see
<BR><a href="http://www.ecse.rpi.edu/Homepages/wrf/">http://www.ecse.rpi.edu/Homepages/wrf/</A><BR><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>
<P>If you create an HTML file with two or more images and image maps, you will
need to edit the map names. The HTMLMAP driver creates its map with the name
<I>map</I>. A small sed script can easily change the map name: </P>
<PRE>sed -e 's/NAME="map"/NAME="foomap"/' <htmlmap >foomap.html
</PRE>
<H2>SEE ALSO</H2>
<EM><a href="pngdriver.html">pngdriver</A></EM>,
<EM><a href="xdriver.html">XDRIVER</A></EM>,
<EM><a href="d.text.html">d.text</A></EM>,
<EM><a href="d.vect.html">d.vect</A></EM>
<p><i>Last changed: $Date: 2004/01/25 13:55:58 $</i>
|