[OpenLayers-Users] Select feature on multiple layers works just for one layer

Andreas Hocevar ahocevar at opengeo.org
Wed Dec 7 16:49:47 EST 2011


Tim has developed this feature already, it just never made it into a
patch: http://trac.osgeo.org/openlayers/browser/sandbox/tschaub/select/lib/OpenLayers/FeatureAgent.js.
Example: http://dev.openlayers.org/sandbox/tschaub/select/examples/feature-events.html

Andreas.

On Wed, Dec 7, 2011 at 10:14 PM, Diego Pasqualin <dpasqualin at gmail.com> wrote:
> I see, your are right, that's the problem!! Thank you very much.
>
> By the way, wouldn't be nice if all overlapping features get the event?
> Something like the "event bubbling" on javascript?
>
> 2011/12/8 Andreas Hocevar <ahocevar at opengeo.org>
>>
>> Layers on top of each other yes. Features no.
>>
>> Andreas.
>>
>> On Dec 7, 2011 8:50 PM, "Diego Pasqualin" <dpasqualin at gmail.com> wrote:
>>>
>>> According to this example is possible to get events from different
>>> layers, but I just can't make it work =(
>>> http://openlayers.org/dev/examples/select-feature-multilayer.html
>>>
>>> 2011/12/8 Andreas Hocevar <ahocevar at opengeo.org>
>>>>
>>>> Hi,
>>>>
>>>> for features that sit on top of each other, you will only get events
>>>> for the top one. Sounds like this is the reason for your problem.
>>>>
>>>> Andreas.
>>>>
>>>> On Sun, Dec 4, 2011 at 9:05 PM, Diego Pasqualin <dpasqualin at gmail.com>
>>>> wrote:
>>>> > Oh, I forgot to put this part of the code, which is run just after the
>>>> > previous code:
>>>> >
>>>> > ---------------------------8<----------------------------------------------------------------------
>>>> >         entities.layer_office.events.on({
>>>> >             'featureselected': function (e)
>>>> > {onFeatureSelect(e.feature,
>>>> > entity.map, control)},
>>>> >             'featureunselected': function (evt)
>>>> > {onFeatureUnselect(evt.feature, entity.map) }
>>>> >         });
>>>> > ... the same for suburbs.suburbs_layer...
>>>> >
>>>> > ---------------------------8<----------------------------------------------------------------------
>>>> >
>>>> > So, I create the control with the layers I want, and after that I use
>>>> > the
>>>> > layers.events.on to run something when the a feature is selected.
>>>> > This is practically the same I saw in some examples. What could be
>>>> > wrong?
>>>> >
>>>> > 2011/12/3 emmexx <emmexx at tiscalinet.it>
>>>> >>
>>>> >> Il 12/02/2011 01:45 AM, Diego Pasqualin scrisse:
>>>> >>
>>>> >> > Any suggestion about what I might be doing wrong?
>>>> >>
>>>> >> Try using eventListeners instead of OnSelect?
>>>> >> Or layer.events.on().
>>>> >>
>>>> >> Bye
>>>> >>        maxx
>>>> >
>>>> >
>>>> >
>>>> > _______________________________________________
>>>> > Users mailing list
>>>> > Users at lists.osgeo.org
>>>> > http://lists.osgeo.org/mailman/listinfo/openlayers-users
>>>> >
>>>>
>>>>
>>>>
>>>> --
>>>> Andreas Hocevar
>>>> OpenGeo - http://opengeo.org/
>>>> Expert service straight from the developers.
>>>
>>>
>



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


More information about the Users mailing list