phpmapscript imagemap creation

Doug Williams williams at WEBSAWYER.COM
Tue Jun 26 18:25:24 EDT 2007


Hello,


I have successfully made an imagemap which I can mouseover and correctly find
polygon shapes.  Below is the the outputformat in my mapfile which properly
generates the map and area coords.  Below the outputformat listing from the
mapfile is the output generated in the html sent to the client browser.


from mapfile:

 OUTPUTFORMAT
     NAME imagemap
     DRIVER imagemap
     FORMATOPTION "POLYHREF="
     FORMATOPTION "MAPNAME=map_test"
     FORMATOPTION "POLYMOUSEOUT=handleClick(event,'boxinfo','hide it','');
return false;"
     FORMATOPTION "POLYMOUSEOVER=handleClick(event,'boxinfo','show it','in');
return false;"
     FORMATOPTION "TITLE="
 END


from generated html:

<map name="map_test" width="600" height="300">
<area onMouseOver="handleClick(event,'boxinfo','show it','in'); return false;"
onMouseOut="handleClick(event,'boxinfo','hide it',''); return false;" title=""
shape="poly" coords=" 358,48, 359,48, 358,47, 358,46, 359,46, 358,45, 360,46,
361,48, 358,48" />
<area onMouseOver="handleClick(event,'boxinfo','show it','in'); return false;"
onMouseOut="handleClick(event,'boxinfo','hide it',''); return false;" title=""
shape="poly" coords=" 130,53, 131,53, 130,54, 131,54, 130,55, 130,56, 128,56,
129,55, 129,54, 130,53" />
....
</map>

This is not a complete listing as indicated by the '....', but serves to show
that I am getting what I want in terms of the image map.

MY PROBLEM is that I cannot figure out how to include attribute data from the
shape file in the html output.  Where my
 
FORMATOPTION "POLYMOUSEOVER=handleClick(event,'boxinfo','show it','in');
return false;"

 does perform as expected, what I would like to do is change the last
parameter in the variables passed to the handleClick javascript function from
the term 'in', which displays the word 'in' when I am moused over a polygon to
one of the identifying attributes from the shape file.  I have tried the
following...(NAME is an attribute in this shape file!)

FORMATOPTION "POLYMOUSEOVER=handleClick(event,'boxinfo','show it','[NAME]');
return false;"

but without the desired effect.  Can anyone help me understand how to retrieve
the shape attribute data.  Is this the right place to grab the attribute?

Thanks,

Doug



More information about the mapserver-users mailing list