Information/Advice about placing markers

Gregor Mosheh gregor at HOSTGIS.COM
Wed Jul 18 17:02:37 PDT 2007


All of what you're asking here sounds to me like OL questions, rather 
than Mapserver. You may have better fortune asking there. Fortunately, 
I've dabbled in OL a bit, so I'll go a little off-topic for ya. :)


> I have a list of all the info I need about the different farm blocks, 
> names of growers, variety of produce etc and I would like to place a 
> marker so that when you hover over it it displays this data.

Using OL's mechanisms, I'd do something along these lines:

Set up the OL map to do click-queries via WFS's getfeatureinfo. See 
http://world.freemap.in/ You'll have to set up your mapfile to act as a 
WFS server, which is very simple following the WFS Server howto on the 
Mapserver documentation site.

Since you want it to click the map on a hover instead of a click, I'd 
probably throw together a combination of JavaScript setTimeout(), and 
extending the map's mouse movement handlers so they the timer is reset 
whenever the mouse moves, and is started when the movement ends.


> Currently all I have is markers being placed on the specific locations 
> with no pop-up info or anything. I don't want to cram my html file full 
> of this info and would prefer if I could import from some sort of a 
> database or text file. (Preferably textfile in the short term for 
> testing but eventually a database would be ideal).

If you use WFS, the data comes from the same data source you're already 
using, saving you the trouble of duplicating it, or writing a database 
app to fetch a single feature and generate XML for it, etc. Hooray for 
OGC standards and to Mapserver for making them easy.

As far as popups go, I think that only RSS layers support that in OL, 
and that's probably not at all what you want. Mapserver itself doesn't 
do anything of the sort, unless you count labels with a colored 
background. Then again, if you're creative, your WFS-query click-handler 
could probably populate a HTML div like in the example at the URL I 
gave, and position the div at the mouse's current location; it'd be some 
work, but probably nothing too arduous if you're handy with JS and HTML.

I hope that helps. Aside from setting up your mapfile to be a WFS 
server, I suspect that most of your work will be in OL or in general 
JavaScript.

-- 
Gregor Mosheh / Greg Allensworth
System Administrator, HostGIS cartographic development & hosting services
http://www.HostGIS.com/

"Remember that no one cares if you can back up,
  only if you can restore." - AMANDA



More information about the MapServer-users mailing list