origo-map / multiselect-plugin

Multiselect plugin for Origo
MIT License
2 stars 10 forks source link

Multiselect and geoserver grouplayers #37

Closed jokd closed 4 months ago

jokd commented 7 months ago

Using any tool other than click on a geoserver grouplayer results in an error. The reason is that you can't make a wfs getfeature request on a group layer. The multiselect tool should be able to handle this somehow, the simplest way is to just ignore the getfeature requests that renders an error instead of just crash.

steff-o commented 7 months ago

Ignoring errors does not seem lika a good idea to me as it may conceal an actual error that causes the user to believe that there are no overlapping features.

The default implementation of WMS layer is to try a WFS getFeature at the same enpoint. That would surely fail.

There are two other (currently undocumented) settings to change this behavior:

The first option is global and overrides the default behavior for all WMS layers and instead of trying to query a WFF layer it creates a WMS getFeatureInfo request that covers an area in the map larger than the the overlay geometry's envelope and the filters the reponse client side. It uses some shenanigans like using a large click buffer and requesting a very small map to get a large coverage. That would probably work on a geoserver grouplayer. It's a bit hacky though and only works for GeoServer.

The other method is defining alternative layers. The setting is a map of layers and which layers should be queried instead. That should also work for grouplayers. Using that method you can define all the layers that the gropu layer consists of as alternative layers. You'll have to look in the code for the exact format. Don't know if it would be possible to use that mechanism as an "ignore" by defining an empty list of alternatives.

Lastly you could define an exact match of layers to query and omit your group layer. Won't work with the default "All visible" though.

If none of the options suits you needs I propose some sort of blacklist of layers that are never queried. Possibly by just fixing the alternative layer config if it is not already working as a blacklist.

steff-o commented 7 months ago

... there is also the documented option exclude... It requries that you configure a selectableLayers option.