javascript - getFeatureFromEvent from multiple layers simultaneously in OpenLayers -
i'm trying return multiple features 2 layers user click (one feature on each layer)?
i'm using openlayers 2.12. have 2 vector layers containing polygons, , container layer containing both.
when clicking both layers contain feature, layer2 feature returned.
how feature @ layer1 of same position?
is there away feature specific layer @ viewport position?
explanation: selectfeature
-control uses layers getfeaturefromevent()
method find one feature click, hover, touch etc. event. if selectfeature controls more 1 layer, glues layers virtual single layer, therefore @ max 1 feature in case, too.
your 1st question: if want select more 1 feature, can use selectfeature's selectbox(openlayers.bounds)
method: if create small bounds position , call selectbox(), all features all layers controlled sc intersecting bounds selected.
your 2nd question: may make openlayer.event viewport position , call getfeaturefromevent() specific layer. of course return 1 feature, if lot features overlapping @ position.
hope helps little.
Comments
Post a Comment