[OpenLayers-Users] triggering a featureselected event?

Chris Abraham cabraham at openplans.org
Tue Apr 28 11:42:39 EDT 2009


Chris,
Thanks for the quick reply.

I have actually already assigned this code to my featureselected and  
featureunselected events for my markers.  The problem with just  
running the code in the onFeatureSelect function is that it doesn't  
close previously opened popups.  I was hoping that by explicitly  
triggering the featureselected event it would implicitly trigger the  
featureunselected event for the previously selected feature and thus  
close the existing popup before opening a new one.  Does that make  
sense?  Do you have any advice on how to do this?

Chris


On Apr 28, 2009, at 11:27 AM, Christopher Schmidt wrote:

> On Tue, Apr 28, 2009 at 11:20:42AM -0400, Chris Abraham wrote:
>> Hi,
>> I'm trying to make links on a page open the popups on features on a
>> map.  I'm trying to accomplish this by triggering a featureselected
>> event on the feature but I'm not sure how to do this.  I have a
>> reference to the feature in my code.  Does anyone know how to trigger
>> the event?
>
> I'm assuming you know that the featureselected event doesn't do  
> anything
> by itself... If you look at the code in:
>
>  http://docs.openlayers.org/library/overlays.html#displaying-popups
>
> Although it is based around selection/unselection, you can ignore the
> 'evt', since you have the 'feature', that you need, and just take the
> onFeatureSelect code and use it directly...
>
> Regards,
> -- 
> Christopher Schmidt
> MetaCarta




More information about the Users mailing list