I have an application which applies cql_filter to multiple WMS services.
For my application, the printing extension fails when printing the map with 2 or more layers,
The frontend makes a request like this against pdf/create.json
{
"units":"m",
"srs":"EPSG:3857",
"layout":"A4 portrait",
"dpi":"180",
"outputFormat":"pdf",
"outputFilename":"leaflet-map",
"layers":[
{
"baseURL":"http://hostname/geoserver/namespace/wms",
"layers" : [
"namespace:MyWMSLayer1"
],
"styles": [
"Style1"
],
"customParams": {
"transparent":true,
"cql_filter":"(\"Period\"='AM')"
}
"type":"WMS", "opacity":1, "format":"image/png", "singleTile": true,
},
{
"baseURL":"http://hostname/geoserver/namespace/wms",
"layers" :
[
"main:MyWMSLayer2"
]
"styles" :[
"Style2"
],
"customParams":{
"transparent":true,
"cql_filter" :"(\"Period\"='AM')"
}
"type":"WMS", "opacity":1, "format":"image/png", "singleTile": true,
}
],
"pages":[{"center":[-168181.4866904761,6873764.30110298],"scale":"100000.0","rotation":0}],
}
And then MapFish logged this
Server returned an error for http://hostname/geoserver/namespace/wms?BBOX=-179382.8866904761%2C6866449.10110298%2C-156980.0866904761%2C6881079.50110298&WIDTH=1960&HEIGHT=1280&format_options=dpi%3A180&map_resolution=180&FORMAT=image%2Fpng&STYLES=Style1%2CStyle2&cql_filter=%28%22Period%22%3D%27AM%27%29&transparent=true&LAYERS=namespace%3AMyWMSLayer1%2Cnamespace%3AMyWMSLayer2&REQUEST=GetMap&SRS=EPSG%3A3857&VERSION=1.1.1&SERVICE=WMS&DPI=180&TRANSPARENT=true: The byte array is not a recognized imageformat.
What I read from above was MapFish has combined all the WMS services from the same host into one but did not combine the cql_filters, so GeoServer complained that…
ERROR [org.geoserver.ows] -
org.geoserver.platform.ServiceException: Layers and filters are mismatched, you need to provide one filter for each layer
Working this around could be very costly (either create hundreds of postgres views for every query combinations or let MapFish create images for each single layer and combine them in wkhtmltopdf).
It would be nice to make MapFish combine cql_filters or stop combining the WMS layers.
Regards,
|