[OpenLayers-Users] Problem with multiple SelectFeature controls

Andreas Hocevar ahocevar at opengeo.org
Thu Jan 15 10:21:55 EST 2009


Hi,

On Wed, Jan 14, 2009 at 2:48 PM, Joao Duarte <joao.c.duarte at co.sapo.pt> wrote:
> I've added several GML layers to the map. Each layer contains data from a
> KML file. The layers are all displayed well, the problem is when I add the
> SelectFeature control. I tried adding one control to each layer but this has
> the problem of only the last added layer gets its control working properly.

You could try the patch "singleroot.3.patch" found at
http://trac.openlayers.org/ticket/1666 (patch is against trunk). An
example is online at
http://dev.openlayers.org/sandbox/ahocevar/singleroot/openlayers/examples/select-feature-multilayer.html

This uses a different approach: you have one SelectFeature control,
and configure it with an array of layers instead of one layer. The
events (e.g. featureselected) will still fire on the separate layers.

If you decide to use that, please report how it works for you by
commenting on the ticket.

Regards,
Andreas.

-- 
Andreas Hocevar
OpenGeo - http://opengeo.org/
Expert service straight from the developers.



More information about the Users mailing list