[mapserver-users] Simple polygon imagemap creation

Burgholzer,Robert rwburgholzer at deq.virginia.gov
Thu May 8 08:19:01 PDT 2008


Charles,
I have done just this thing, and it is quite easy.  Coincidentally, I
have just completed a set of these for Virginia's Water Resources
division.  

I am doing this for a drought monitoring application, creating static,
clickable image maps that then connect to a small data retrieval
application.  Here is an example (coincidentally on the Virginia - North
Carolina border):
http://www.deq.virginia.gov/watersupplyplanning/drought/southside/curren
t.html 

I based my version on a good example by Steve Lime:
http://maps.dnr.state.mn.us/cgi-bin/mapserv48?map=/usr/local/www/docs_ma
ps/eco/rsg/search/search_example.map&qlayer=county&mode=nquery&searchmap
=true

Anyhow, the basics are: the layer that defines the image map needs to
have header, footer, and body templates set. The header just has to open
the <map> tag, and the footer closes it </map>, and the bodytemplate has
to have the stuff that tells mapserver where to put the shapes.
Entities in brackets [] in these files are variables from your layer.
In my example, I am using a PostGIS layer, but the same holds true for
shapefiles.  The only other contingency is that you should have a
querymap defined (at least in the way that I am calling it, one needs
this), and that is simple:

QUERYMAP
 STATUS ON
 STYLE NORMAL
END

Please get in touch if I can help at all.

I call it with the following:
http://172.16.210.66/cgi-bin/mapserv.exe?map=C:\usr\local\home\httpd\deq
_website\watersupplyplanning\drought\state\imagemap.map&qlayer=proj_segg
roups&mode=nquery&layers=proj_seggroups%20sym_box%20sym_flow%20sym_preci
p%20poli_bounds%20copyright%20sym_pdi%20sym_gw%20statusnormal%20statuswa
rn%20statuswatch%20statusemerg%20statusblank

My layer, and templates are as follows:

LAYER
   CONNECTIONTYPE postgis
   CONNECTION "host=localhost user=dbfoo password=xoxoxo dbname=wsp"
   NAME proj_seggroups
   GROUP proj_seggroups
   TYPE POLYGON
   STATUS ON
   DEBUG OFF
   DATA "the_geom from proj_seggroups"
   TEMPLATE "bodytemplate.html"
   HEADER "imapheader.html"
   FOOTER "imapfooter.html"
   CLASS
      NAME "proj_seggroups"
      SYMBOL 'circle'
      SIZE 3
      COLOR -1 -1 -1
      BACKGROUNDCOLOR 0 0 0
      OUTLINECOLOR 0 0 0
   END
   TOLERANCE 10
   PROJECTION
     "proj=latlong"
   END
  METADATA
    "DESCRIPTION"   "Stat Results"
  END
END

imapheader.html:
<map id="droughtmap" name="droughtmap">

bodytemplate.html:
<area shape="poly" coords="[shpxy precision=0 proj=image]"
href="/watersupplyplanning/scripts/drought/show_data.php?gid=[gid]&group
name=[groupname]&site_no=[site_no]&imageurl=/watersupplyplanning/scripts
/drought/images" onClick="return openWin(this.href,800,600, 'Drought
Data')" title="[groupname]" alt="[groupname]">

imapfooter.html:
</map>
<img src="[img]" width="[mapwidth]" height="[mapheight]"
usemap="droughtmap" border=0>





Robert W. Burgholzer
Surface Water Modeler
Office of Water Supply and Planning
Virginia Department of Environmental Quality
rwburgholzer at deq.virginia.gov
804-698-4405
Open Source Modeling Tools:
http://sourceforge.net/projects/npsource/

-----Original Message-----
From: mapserver-users-bounces at lists.osgeo.org
[mailto:mapserver-users-bounces at lists.osgeo.org] On Behalf Of Charles
Theobald
Sent: Thursday, May 08, 2008 10:38 AM
To: mapserver-users at lists.osgeo.org
Subject: [mapserver-users] Simple polygon imagemap creation

Does anyone have an code example of a simple polygon imagemap?  We want 
to display a county map, and go to a specific page for the county that 
is selected (clicked on).  Thanks in advance.

-- 
Charles Theobald
NC Division of Water Resources
charles.theobald at ncmail.net
919-715-5425 

_______________________________________________
mapserver-users mailing list
mapserver-users at lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/mapserver-users



More information about the MapServer-users mailing list