0

I am trying to add a cql filter to a WMS QgsRasterLayer. I was able to pull in the layer using this code:

urlWithParams="contextualWMSLegend=0&crs=EPSG:4326&IgnoreGetMapUrl=1&format=image/png&layers=locations:deerwgs&styles&url=https://localhost:8080/geoserver/wms%3FCQL_FILTER=(aid=%MULD2720112947%27)"
rlayer = QgsRasterLayer(urlWithParams, 'deerwgs', 'wms')
QgsProject.instance().addMapLayer(rlayer)

Result url: http://localhost:8080/geoserver/wms?CQL_FILTER=(aid%3D%27MULD20112947%27)&SERVICE=WMS&VERSION=1.3.0&REQUEST=GetMap&BBOX=44.74008059553205641,-121.8661270141599999,44.92827190130818593,-120.9374197909033626&CRS=EPSG:4326&WIDTH=1205&HEIGHT=244&LAYERS=locations:deerwgs&STYLES=&FORMAT=image/png&DPI=96&MAP_RESOLUTION=96&FORMAT_OPTIONS=dpi:96&TRANSPARENT=TRUE

but no image is displaying. When I copy the actual url outputted in the log into the browser the expected image does return successfully. I am not sure what my next steps are to go about debugging.

1 Answer 1

0

Got it figured out. We are using a proxy, and with the ignoregetmapurl set to true, the image is routed through the ../wms and not ../ows. I had not set up the wms endpoint to handle images.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.