Imagemaps

Rob P. rob at DATAFLOWDESIGN.COM
Tue Apr 12 16:57:42 EDT 2005


>>>>> "Scott" == Scott Knutti <sknutti at SMUMN.EDU> writes:

    Scott> For those who have gotten the imagemap thing to work...
    Scott> should the imagemap_url return the imagemap code or is that
    Scott> stored in a text file in the same location?  When I try to
    Scott> include the imagemap portion of the page, it errors out
    Scott> because it can't include an image.  Any ideas?

    Scott> Thanks, Scott

hi Scott,
I dabbled with this a bit. I found documentation in the wiki and in
the source code in a file named mapimagemap.c.  My php script used 2
map files. One map file was for rendering the image, which I copied
and added outputformat statements for generating the imagemap:

IMAGETYPE imagemap
OUTPUTFORMAT
     NAME imagemap
     DRIVER imagemap
     FORMATOPTION "POLYHREF=#"
     FORMATOPTION "SYMBOLHREF=#"
     FORMATOPTION "SUPPRESS=YES"
     FORMATOPTION "MAPNAME=tulsamap"
     FORMATOPTION "POLYMOUSEOUT=return nd();"
     FORMATOPTION "POLYMOUSEOVER=return overlib('%s');"
     MIMETYPE "text/html"
END

Not sure if you can do this without scripting.
My php script disabled unwanted layers and dumped the coordinates into
the html stream:

$imgM = $mapImg->draw();
echo "<map name ....
## File name should be zero length string so that
## the imagemap gets dumped to the html stream
$imgM->saveImage("", $mapImg);
echo "</map>\n";

This actually worked quite well. I had one problem, though. If the map
was empty (no features within the map extents) the php session would
crash with no error messages. See note submitted to list on April 1.

Rob



More information about the mapserver-users mailing list