php/mapscript and client-side imagemaps
Daniel Morissette
dmorissette at MAPGEARS.COM
Wed Apr 4 10:29:47 PDT 2007
Matt Pettis wrote:
> Hi,
>
> I'm trying to get generate a client side imagemap (the <map>...</map>) coordinates and inserting the text using just php/mapscript (avoiding using the templating methods found at http://mapserver.gis.umn.edu/docs/howto/imagemaps because I want as pure a php solution as i can get). I found the wiki entry for this (http://mapserver.gis.umn.edu/cgi-bin/wiki.pl?ImageMap), and followed its instructions. In particular, the following lines did not generate what I thought:
>
> $imgmap = ms_newMapObj( "C:\\ms4w\\Apache\\htdocs\\postgis\\imgmap.map" );
> $imgmapimg = $imgmap->draw();
> $imgmapurl = $imgmapimg->saveWebImage(MS_IMAGEMAP,1,1,0);
>
> I couldn't find documentation on saveWebImage, but I thought it would generate the text i would need to include in a <map> section for my webpage. Instead, what was generated was a .png file. Should this be usable as an image map, or did I get this in error (the page rendered just fine).
>
The PHP MapScript saveWebImage doc is at:
http://mapserver.gis.umn.edu/docs/reference/phpmapscript-class/classes/imageobj
The Wiki page that you were looking at needs comes from the old/frozen
wiki so it's out of date and will never be updated. The saveWebImage
method doesn't take any arguments any more. Instead, you have to pick
your output format using selectOutputFormat() before the draw() call.
Something like this might work:
$imgmap = ms_newMapObj( "C:\\ms4w\\Apache\\htdocs\\postgis\\imgmap.map" );
$imgmap->selectOutputFormat("imagemap");
$imgmapimg = $imgmap->draw();
$imgmapurl = $imgmapimg->saveWebImage();
Daniel
--
Daniel Morissette
http://www.mapgears.com/
More information about the MapServer-users
mailing list