Highlighting features on mouse over

Arnulf Christl arnulf.christl at CCGIS.DE
Fri Mar 18 03:30:52 PST 2005


Gambin Dejan wrote:
> Hello,
>
> I would like to be able to highlight the feature (a polygon or its
> outline for example) while moving the mouse over the map. Is it possible
> without having swf output?
>
> Thanks
>
> Dejan
>

Yes, there are several possibilities to do this. As usual we try to
implement it using OGC standards only. Have a look at this example:
http://www.mapbender.org/demoserver.html

You need:
- MapServer as WMS
- MapServer as WFS (WMS with DUMP=true might also do)
- Mapbender

1. Query the WFS for a feature (enter 5311 into the field "Plz:" and
click OK)
2. MapServer answers to this request by returning the geometry as GML
3. Mapbender takes and translates this GML into an HTML text (53111...)
with JavaScript over-, out- and click-actions.

<html><head><link rel='stylesheet' type='text/css'
href='../css/wfs_gazetteer.css' /></head><body><a
href='javascript:parent.setResult("click","3365496.566430,5624978.448441,
[...] 5624978.448441","500")'
onmouseover='parent.setResult("over","3365496.566430,5624978.448441,
[...] 5624978.448441")'
onmouseout='parent.setResult("out","3365496.566430,5624978.448441,
[...] 5624978.448441")'
onclick='parent.setPermanentMarker("3365496.566430,5624978.448441,
[...] 5624978.448441")'>53111</a><br><a

[...]

4. When you move the mouse over the text the JavaScript
setResult("over") is executed. It calls a Mapbender script that renders
the GML on the server an sends it back as yet another image which is put
on top of the map sandwich already visible in the map frame.
5. When you click on the text setResult("click"...) is executed
redefining the bounding box of the map with the bbox of GML (+500 meters
buffer in this case) and the corresponding getMaps are generated.

There are probably a lot easier ways to do this but this one is fairly
interoperable.
You can use GeoServer as WFS-T instead of UMN MapServer which might have
advantages with large datasets and might later provide for editing
capabilties. You can include any other WMS as background maps in the
mapframe sandwich.

Best, Arnulf.

--
------------------------
Arnulf B. Christl
------------------------
http://www.ccgis.org
http://www.mapbender.org
------------------------



More information about the MapServer-users mailing list