Allow the WMS MapContent to be manipulated by plugins before rendering occurs
Choose one of: Under Discussion, In Progress, Completed, Rejected, Deferred
The DispatcherCallback provides a nice way to manipulate a request to the plugin implementor will.
The WMS GetMap path ends up building a WebMapContent which is the passed to the various rendering engines, however, once build, it's not possible to manipulate it in a pluggable way, disallowing customizations.
We propose to create a new interface, tentatively called GetMapCallback, mimicking the DispatcherCallback basic idea, that is, to follow and manipulate the internal lifecycle of a GetMap request:
With the above callback the implementor is allowed to:
- inspect and modify the WebMapRequest
- inspect, modify and remove Layer objects from the MapContent
- inspect and modify the WMSMapContent
- inspect and modify the resulting WebMap
- throw unchecked exceptions, covering both the case of security checks compatible with Spring security, and OGC service exceptions, suitable for other types of checks.
In case multiple GetMapCallback are found the code will "chain" them, making each one work on the results of the previous call.
The first implementation of this interface will be used to implement a WMS-EO requirement. In the WMS-EO layer tree for a certain EO product there is a <layer>_bands sub-layer advertising the bands of the product as separate WMS dimensions using the BANDS custom dimension.
If the user asks for one band, the code will have to return a gray map with that band, if three values are specified, then a RGB map will be composed with them, otherwise an exception must be thrown.
The code will check the proper usage of the dimension values, and manipulate the raster layer description in order to switch the image mosaic to the STACK mode, required to perform the band merging.
Other possible usages are related to security checks, per user customization of the generated map, and custom map decoration additions using DirectLayer.
This section should contain feedback provided by PSC members who may have a problem with the proposal.
No backwards compatibility issues found.