[Mapserver-users] Imagemap from shapefile?

Dave Walton mapserver at digger.net
Tue Feb 17 04:08:14 EST 2004


On Mon, 16 Feb 2004 01:55:29 -0600
blammo <bob.basques at ci.stpaul.mn.us> wrote:

> Dave Walton wrote:
> 
> >I'm not sure how feasible this is, but I'd like to be able to generate
> >a client-side imagemap to be used with MapServer-created images.  The
> >imagemap would have clickable areas that would match up to certain
> >polygons drawn by MapServer.
> >
> I've asked about this a couple of times myself.  I believe there is 
> something in the works on it, I have no idea of the timeline though.  
> One item related to this would be how to retrieve such an animal for 
> inclusion into a Page, I know it could be planted somewhere on the 
> server temporarily, but how to best incorporate it into a page coming 
> from a CGI.

A few hours after I posted that question, I stumbled across this page in
the Wiki while searching for something else entirely:

http://mapserver.gis.umn.edu/cgi-bin/wiki.pl?ImageMap

It's rather less helpful than it needs to be, but it pointed me in an
interesting direction.  After much grepping in the MapServer 4.0.1 source,
I finally figured out that you can enable IMAGETYPE IMAGEMAP by
uncommenting the block of code containing the call to msImageCreateIM() in
mapdraw.c.  I haven't got it fully working yet, but it's got potential.

It appears that MapServer can either save the imagemap to a temp file or
output it directly, just like with map images, though I've only tested
direct output.

Anyway, IMAGETYPE IMAGEMAP won't really work too well for me in its
current form, but I have some thoughts for flexibility improvements that I
plan to discuss with the author when I get a chance to contact him. 
Though I really ought to see if I can get it fully working as-is, first.

> I tend to use MapServer as an Image engine for use in my own Frontends.

Exactly what I'm doing, too.  I've got a PHP script (not using mapscript
so far) that figures out what parameters to use for the image it needs,
fetches the image from MapServer, and does some post-processing on it
before sending it back to the browser.  It has the interesting
side-benefit of preventing anyone messing around with MapServer
parameters.

>  There are some other interesting items related to the development as 
> well.  While polygons are fairly straightforward, a imagemap for 
> linework might be a bit more involved.  Settings for widths of hot areas
> and such would need to be added in.

Fortunately, the most common use would be for polygons and markers.

> Some interesting constructs can also be built on the client side with 
> such pieces.  DHTML for example could pull a seperate IMAGEMAP for 
> seperate images in DIVs that could be interactively swapped out at the 
> client.

Oooh, and a separate IMAGEMAP for different layers in one image, too!

Dave


-- 
----------------------------------------------------------------------
Dave Walton                                            dwalton at acm.org
----------------------------------------------------------------------



More information about the mapserver-users mailing list