[OpenLayers-Users] SelectFeature with multi-vector-layers
Horst Garstka
horst at hike.de
Thu Feb 14 00:20:21 PST 2013
THX for your proposal. But that's just what I already tried to do:
Here the code snippet, which does not work:
....
selectControl = new OpenLayers.Control.SelectFeature([layer1, layer2],
{
clickout: false,
hover: true
}
);
map.addControl(selectControl);
selectControl.activate();
layer1.events.on({
'featureselected': onFeatureSelect,
'featureunselect': onFeatureUnselect
});
layer2.events.on({
'featureselected': onFeatureSelect,
'featureunselect': onFeatureUnselect
});
....
Not one of the features on layer1 or layer2 can be selected.
But if I change the first line to:
selectControl = new OpenLayers.Control.SelectFeature(layer1,
...
I can select the features of layer1 via mouse over.
Gruss
Horst
Am 13.02.2013 11:20, schrieb Meine Toonen:
> Try to pass the instantiated object into the array:
>
> this.selectCtrl = new
> OpenLayers.Control.SelectFeature([this.vectorLayer,
> this.rseqVectorLayer],{});
>
> Here this.vectorLayer and this.rseqVectorLayer are the instantiated
> objects of OpenLayers.Layer.Vector.
>
> Met vriendelijke groet,
>
> Meine Toonen
> B3Partners BV
> Tel: 030 214 2083
>
> ------------------------------------------------------------------------
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/openlayers-users/attachments/20130214/fa700389/attachment.html>
More information about the Users
mailing list