qwc-services / qwc-ogc-service

QWC OGC service
MIT License
3 stars 9 forks source link

Layer opacity is missing while requesting qgis server through the ogc service #23

Open danceb opened 3 months ago

danceb commented 3 months ago

Within QGIS there is the option to set the layer opacity within the layer rendering options in the symboly definition: https://docs.qgis.org/3.34/en/docs/user_manual/working_with_vector/vector_properties.html#layer-rendering

This option is not considered with a getmap request through the ogc service, but is considered, if the qgis server is requested directly.

Request through the ogc service: image

Request through the qgis server directly: image

manisandro commented 3 months ago

Can you compare the GetMap requests which the QGIS Server receives when invoked directly vs through the ogc-service?

danceb commented 3 months ago

The request within the browser:

/ows/strassen_transp?REQUEST=GetMap&SERVICE=WMS&VERSION=1.3.0&FORMAT=image/png&STYLES=default&TRANSPARENT=true&LAYERS=Strassen_transp&SRS=EPSG:25832&CRS=EPSG:25832&TILED=false&DPI=96&OPACITIES=255&FILTER=&WIDTH=1920&HEIGHT=594&BBOX=680514.0544603983,5644623.8486520015,683054.0544603983,5645409.6611520015

request from the logs with qgis server:

/ows/strassen_transp?
REQUEST=GetMap&
SERVICE=WMS&
VERSION=1.3.0&
FORMAT=image/png&
STYLES=default&
TRANSPARENT=true&
LAYERS=Strassen_transp&
SRS=EPSG:25832&
CRS=EPSG:25832&
TILED=false&
DPI=96&
OPACITIES=255&
FILTER=&
WIDTH=1920&HEIGHT=594&
BBOX=680514.0544603983,5644623.8486520015,683054.0544603983,5645409.6611520015

request from the logs with ogc service:

/ows/strassen_transp?
REQUEST=GetMap&
SERVICE=WMS&
VERSION=1.3.0&
FORMAT=image%2Fpng&
STYLES=%2C%2C%2C&
TRANSPARENT=true&
LAYERS=Nebenstra%C3%9Fe_Jena%2CHauptstra%C3%9Fe_Jena%2CNebenstra%C3%9Fe_Jena+Label%2CHauptstra%C3%9Fe_Jena+Label&
SRS=EPSG%3A25832&
CRS=EPSG%3A25832&
TILED=false&
DPI=96&
OPACITIES=255%2C255%2C255%2C255&
FILTER=&
WIDTH=1920&HEIGHT=594&
BBOX=680514.0544603983%2C5644623.8486520015%2C683054.0544603983%2C5645409.6611520015

In both times I requested the project itself. The difference here is that the ogc service requests the individual layers as the qgis server requests the project as it is named within the request.

This leads me to request the qgis server directly the same way with the individual layers and there the opacity is not working too! It only works if you requested the project directly and not the individual layers. So it is a qgis server issue and not a ogc service one ...

danceb commented 3 months ago

Ah no, it seems to be an ogc service issue after all...

I recognized that the layers are request individually but the opacity value within the request is 255 for anyone of them. So I tested to request a single layer without the OPACITIES parameter, so the value should be get from the layer style.

OGC Service, layer is not transparent: http://localhost:8080/ows/strassen_transp?REQUEST=GetMap&SERVICE=WMS&VERSION=1.3.0&FORMAT=image%2Fpng&STYLES=&TRANSPARENT=true&LAYERS=Nebenstra%C3%9Fe_Jena&SRS=EPSG%3A25832&CRS=EPSG%3A25832&TILED=false&DPI=96&FILTER=&WIDTH=1920&HEIGHT=594&BBOX=680514.0544603983%2C5644623.8486520015%2C683054.0544603983%2C5645409.6611520015

QGIS Server, layer is transparent: http://localhost:8001/ows/strassen_transp?REQUEST=GetMap&SERVICE=WMS&VERSION=1.3.0&FORMAT=image%2Fpng&STYLES=&TRANSPARENT=true&LAYERS=Nebenstra%C3%9Fe_Jena&SRS=EPSG%3A25832&CRS=EPSG%3A25832&TILED=false&DPI=96&FILTER=&WIDTH=1920&HEIGHT=594&BBOX=680514.0544603983%2C5644623.8486520015%2C683054.0544603983%2C5645409.6611520015

These are the URLs from the QGIS Server log, so there is no OPACITIES parameter, but somehow the value is calculated in the back and the map is rendered accordingly.

Edit: So there are to things happening here in the OGC Service: If the opacity is set to 255 for a group of layers within the request, this value is used for all of the layers within this group, ignoring the actual values. If the OPACITIES parameter is missing at all it is set to 255, regardless how many layers are requested.