[OpenLayers-Users] Best way to implement hover/click highlighting of polygons

Eric Lemoine eric.lemoine at camptocamp.com
Mon Aug 31 00:52:20 EDT 2009


On Monday, August 31, 2009, Peter Becker <pbecker at itee.uq.edu.au> wrote:
> Hello all,

Hi


>
> I know it is a bit of a broad question, but after quite a few experiments I still feel a bit puzzled as to which way I want to set up a map in our application. The map displays certain areas (catchments, bay areas, etc.). The user should be able to click on those areas, which then shows detailed information in a side bar (div on the same level as the map's div).
>
> We are using a stack with PostGIS and GeoServer and I managed to get the basic functionality working in different ways, e.g. using GeoServer's map previews as example as well as http://openlayers.org/dev/examples/getfeature-wfs.html .
>
> But getting it to work is only one thing, I'd like to get some more understanding on the implications of different approaches. The two main concerns for me at the moment are the browser support and the number of roundtrips some approaches seem to take.
>
> I saw http://trac.openlayers.org/wiki/Browsers -- does that mean all OpenLayers features are fully supported in each of these? Can I e.g. use an all-vector approach for the overlays and expect them to work?

Yes, vector layers are supposed to work in every listed browser. But
you will get different results in terms of performance from one
browser to another. For example IE will require much more time than FF
and Chrome to display geometries on vector layers. Depending on the
number of geometries, display time may be so long so that it can
become unacceptable.


>
> And regarding the round trips: I would like the map view not to hit our server more than once per interaction -- mostly to keep the map snappy, but also to not but unnecessary burden on the server. The UI won't allow arbitrary zooming and panning, so bounds should get invalidated only as a result of some custom callback.
>
> I was thinking along the lines of loading all polygons as WFS layer -- is that the way to do it?

Possibly. Again it depends on the number of objects you need to
display and the browsers you want to support. I'd recommend doing
experiments with your dataset.

> Should I set a specific strategy?

You can use the BBOX strategy so that only features included in the
current extent of the map are fetched and displayed. As the map is
moved new features will be fetched from the server.

Cheers,


> I can't find much documentation on strategies.
>
> Thanks for any hints/experiences you are willing to share.
>
> Cheers,
>   Peter

-- 
Eric Lemoine

Camptocamp France SAS
Savoie Technolac, BP 352
73377 Le Bourget du Lac, Cedex

Tel : 00 33 4 79 44 44 96
Mail : eric.lemoine at camptocamp.com
http://www.camptocamp.com



More information about the Users mailing list