[OpenLayers-Users] SelectFeature usage in OpenLayers 2.7
Subha Ramakrishnan
subha at gslab.com
Fri Jan 30 08:45:00 EST 2009
Hi
Thanks a lot for the help.
It works fine now.
Thanks again.
Regards,
Subha
Christopher Schmidt wrote:
> On Fri, Jan 30, 2009 at 06:40:56PM +0530, Subha Ramakrishnan wrote:
>
>> 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?
>>
>
> There is no need to register a selectFeature control per point. Instead,
> register a single selectFeature control for the layer.
>
> This is demonstrated in:
>
> http://openlayers.org/dev/examples/select-feature-openpopup.html
> http://openlayers.org/dev/examples/sundials-spherical-mercator.html
>
> It is also documented as pat of a tutorial in:
>
> http://docs.openlayers.org/library/overlays#displaying-popups
>
> Regards,
>
More information about the Users
mailing list