[OpenLayers-Users] Order/Priority of Control.GetFeature and Control.WMSGetFeatureInfo on click?

nica a.walter at gsi.de
Thu Aug 23 02:35:20 PDT 2012


Hello,

I am unsure if OpenLayers provides any way to control the order in which
controls handle events.

---Situation:
I have a WMS layer with multiple features very close together.
I use Control.WMSGetFeatureInfo to get general information about all the
features within the search radius around a  click.
I also use Control.GetFeature to get specific information for a single
feature when it is selected.

Both controls do those jobs like they're supposed to do.

Now, I only need the WMSGetFeatureInfo if no actual feature was clicked
(i.e. selected by GetFeature). If GetFeature doesn't hit a feature
(clickout), the WMSGetFeatureInfo should work as usual.


---Problem: 
WMSGetFeatureInfo is always called before GetFeature, so it is always
performed regardless of GetFeature selected a feature or not, and I cannot
figure out a way to make it go last (so it could change its behaviour
according to GetFeature's results).


---What I've tried:
* Switching around the order in which those two Controls were created, added
to the map, activated. Didn't manage to make GetFeature go before
WMSGetFeatureInfo. (Maybe I missed the correct order?)

* Setting GetFeature's click handler's stopSingle option to true, but then
WMSGetFeatureInfo obviously won't be called when no feature was hit, either.

* Deactivating WMSGetFeatureInfo when GetFeature was active, and activating
WMSGetFeatureInfo when GetFeature registered a clickout. But then the click
event that triggered GetFeature in the first place doesn't get handed to
WMSGetFeatureInfo.


Any thoughts/tips what else I can try to get my desired behaviour? 



--
View this message in context: http://osgeo-org.1560.n6.nabble.com/Order-Priority-of-Control-GetFeature-and-Control-WMSGetFeatureInfo-on-click-tp4997282.html
Sent from the OpenLayers Users mailing list archive at Nabble.com.


More information about the Users mailing list