[OpenLayers-Users] Problem with multiple SelectFeature controls

Andre Pereira de Matos andre.matos at co.sapo.pt
Wed Jan 14 13:13:48 EST 2009


We have implemented another solution for this problem...

We made a control that throws events (click, mouseover, mouseout) for a specific group of features, and we don't mind if the features are in different layers or not.

It just works... If anyone want the code I can share it...

I sent a mail to openlayers dev to contribut with it, and I am still waiting for any replay.

Regards,
André Matos
http://maps.sapo.pt


-----Original Message-----
From: users-bounces at openlayers.org [mailto:users-bounces at openlayers.org] On Behalf Of Bill Thoen
Sent: quarta-feira, 14 de Janeiro de 2009 16:43
To: Joao Campos Duarte (PRIMEIT)
Cc: users at openlayers.org
Subject: Re: [OpenLayers-Users] Problem with multiple SelectFeature controls

 From the responses I'm getting in the "[OpenLayers-Users] Switching
Layers Assigned to a SelectFeature Control" thread and some Googling it
appears that handling multiple vector layers simultaneously in
OpenLayers is not well supported. In fact, it basically won't work. Only
one layer of features can be selectable at a time.

What I'm trying is to create only one SelectFeature control, but then
allow the user to pick which layer they want to be "active". After they
choose, I destroy the current SelectFeature control and replace it with
a new SelectFeature control that uses the new layer. It's not elegant,
but it seems to work.




Joao Duarte wrote:
>
> Hi,
>
> 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.
>
> The problem seems to be caused by the Feature handler. If you have
> many Feature handlers, only the one assigned to the top layer will work.
>
> Any suggestions on how I can have multiple SelectFeature controls,
> each one associated with a different layer, all working?
>
> Best regards,
>
> João Duarte
>
> http://maps.sapo.pt
>

_______________________________________________
Users mailing list
Users at openlayers.org
http://openlayers.org/mailman/listinfo/users



More information about the Users mailing list