[OpenLayers-Users] How to Add Multi-Vector-Layers into
SelectFeature?
Christopher Schmidt
crschmidt at metacarta.com
Mon Jul 16 11:15:25 EDT 2007
On Mon, Jul 16, 2007 at 06:46:14AM -0700, RaymondLv wrote:
>
> I'm a beginner to OpenLayers and have three vector layers below, but only one
> gml layer can be hovered or selected.
> How to add them all into SelectFeature?
You must create three seperate selectfeature controls. (The
openmnnd.html demo shows how to set up two, I think.) Only one can be
enabled at a time. This is, as they say, 'just the way it works'.
http://trac.openlayers.org/ticket/434 is a tracking bug for fixing this:
I think Cameron has a desire to change it, but no code currently exists
for this in OL.
-- Chris
> many thanks
>
> /*******************************************************************/
> var gml110=new OpenLayers.Layer.GML("110kv",
> "110.xml",{style:style_yellow});
> map.addLayer(gml110);
>
> var gml220=new OpenLayers.Layer.GML("220Kv", "220.xml",{style:style_red});
> map.addLayer(gml220);
>
> var vectors = new OpenLayers.Layer.Vector( "Editable Vector Layer");
> map.addLayer(vectors);
> map.addControl(new OpenLayers.Control.EditingToolbar(vectors));
>
> var vctoptions = {
> hover: false,
> onSelect: displayWKT
> };
>
> var drawControls = new OpenLayers.Control.SelectFeature(gml110, vctoptions);
> map.addControl(drawControls);
> drawControls.activate();
> /*******************************************************************/
> --
> View this message in context: http://www.nabble.com/How-to--Add-Multi-Vector-Layers-into-SelectFeature--tf4079356.html#a11594470
> Sent from the OpenLayers Users mailing list archive at Nabble.com.
>
> _______________________________________________
> Users mailing list
> Users at openlayers.org
> http://openlayers.org/mailman/listinfo/users
>
--
Christopher Schmidt
MetaCarta
More information about the Users
mailing list