[OpenLayers-Users] SelectFeature usage in OpenLayers 2.7

Subha Ramakrishnan subha at gslab.com
Fri Jan 30 08:10:56 EST 2009


Hi

I am using Openlayers with mapserver and recently upgraded to Openlayers 
2.7.
 From the documentation and the mail archive, I found that there is a 
change with this control from 2.6 to 2.7.

I've a vector layer with multiple points on it. And for every point i 
add a selectFeature to show a pop up on clicking it.
The problem here is the z-index of the layer. The moment i add the first 
selectFeature to the layer, the z-index goes up to "725" from some value 
in 300 range. Then with every control's activate call 
[selectControl.activate()], the z-index of the layer increases by 1 and 
it goes beyond 750, resulting in problems with displaying pop up.

This is my code:

var point = new 
OpenLayers.Geometry.Point(parseFloat(loc1),parseFloat(loc2));
var pointFeature = new OpenLayers.Feature.Vector(point);
vectorLayer.addFeatures([pointFeature]);
selectControl = new OpenLayers.Control.SelectFeature(vectorLayer,
{onSelect: onPointSelect, onUnselect: onPointUnselect,toggle : true});
map.addControl(selectControl);
selectControl.activate();

Am i doing something wrong here?
Is there any other way to show a pop up on clicking the point?

Please help.
Thanks a lot.

Regards,
Subha



More information about the Users mailing list