[OpenLayers-Users] select feature control not working

Andreas Hocevar ahocevar at opengeo.org
Thu Jun 3 07:52:44 EDT 2010


Hi,

the OpenLayers versions that ship with GeoServer only include the functionality that is needed for the GeoServer layer preview. Please download a full version from http://openlayers.org

Regards,
Andreas.

On Jun 3, 2010, at 13:46 , Imran Rajjad wrote:

> thanks for your reply
> 
> I`m using the one that comes with geoserver 1.7.7 . not too sure about
> the version. But the select and highlight works. When I tried the code
> on my page.. only the highlight control was working with a highlight
> color different from the one in example. Later through console i
> deactivated the highlight control and then activated the select
> control .. then the select control started working .. the events are
> also getting triggered.i was hoping to get to the attributes of the
> feature clicked at.
> 
> On Thu, Jun 3, 2010 at 4:31 PM, Eric Lemoine
> <eric.lemoine at camptocamp.com> wrote:
>> On Thu, Jun 3, 2010 at 12:01 PM, Imran Rajjad <rajjad at gmail.com> wrote:
>>> I`m trying to run a function on clicking and highlighting of a vector
>>> layer. the events do not seem to trigger..
>>> 
>>> what am i doing wrong here?
>>> 
>>> my code
>>> 
>>> 
>>> 
>>> var report = function(e) { // it will be called when event is trigered
>>> from eventListeners
>>>                console.log(e.type, e.feature.id);
>>>                //alert(e.feature.id);
>>> 
>>>            };
>>> 
>>>            var highlightCtrl = new
>>> OpenLayers.Control.SelectFeature(vector_layer, {
>>>                hover: true,
>>>                highlightOnly: true,
>>>                renderIntent: "highlight",
>>>                eventListeners: {
>>>                    beforefeaturehighlighted: report,
>>>                    featurehighlighted: report,
>>>                    featureunhighlighted: report
>>>                }
>>>            });
>>> 
>>>            var selectCtrl = new OpenLayers.Control.SelectFeature(vector_layer,
>>>                {clickout: true}
>>>            );
>>> 
>>>            map.addControl(highlightCtrl); // add high lighting
>>>            map.addControl(selectCtrl); // add selection
>>> 
>>>            highlightCtrl.activate();
>>>            selectCtrl.activate();
>> 
>> 
>> What OpenLayers version do you use? Does the highlight-feature.html
>> example of your OpenLayers distribution work?
>> 
>> Cheers,
>> 
>> --
>> Eric Lemoine
>> 
>> Camptocamp France SAS
>> Savoie Technolac, BP 352
>> 73377 Le Bourget du Lac, Cedex
>> 
>> Tel : 00 33 4 79 44 44 96
>> Mail : eric.lemoine at camptocamp.com
>> http://www.camptocamp.com
>> 
> 
> 
> 
> -- 
> I.R
> _______________________________________________
> Users mailing list
> Users at openlayers.org
> http://openlayers.org/mailman/listinfo/users



-- 
Andreas Hocevar
OpenGeo - http://opengeo.org/
Expert service straight from the developers.




More information about the Users mailing list