I managed to get this working with GeoServer but I'd like to see if it's also possible with MapServer.
I need to generate a dynamic copyright. I have a polygon layer in Oracle Spatial which contains the names of the data providers and the areas they provided. The copyright is updated at each pan and zoom.
With Geoserver, I created a custom function which captures all the polygons returned by the spatial query (performed by geoserver). From those, I get all the provider names (which are stored in an attribute of the polygon layer) into a string, generate a point (ex: bottom-center) and use the string as its label.
The custom function yields a single point with its label. This function is called during every WMS request to this layer.
How could I achieve the same thing with MapServer ?
Is it possible to get the resulting polygons with a mapscript ?
Is it possible to create a point at runtime with a mapscript ?
Should I capture the bbox parameter from the query :
req = mapscript.OWSRequest() req.loadParams() bbox = req.getValueByName('BBOX')
...and perform the spatial query myself (using the bbox) ? That way, I could get only the provider names. I could then add the point and define its label using the results of the query.
Maybe I can create a mapFile with a custom spatial query and return a single point with its label in another field. That way a simple map file could be used to achieve the same result. I read that it's not possible to have a layer with invisible features (opacity : 0) but the labels visible so it's probably not the solution.
Here's a picture of the results in GeoServer. There's a raster layer and on top of it, there's the dynamic copyright layer. This layer contains a single invisible point (opacity : 0) with its label (which is visible). The point is positioned at the bottom-center :