qwc-services / qwc-qgis-server-plugins

Plugins for extending QGIS Server for QWC
0 stars 3 forks source link

plugin "wms_geotiff_output" is destroying capabilities document #4

Open danceb opened 5 days ago

danceb commented 5 days ago

Using the "wms_geotiff_output" plugin, the xml which is requested with GetCapabilities and GetProjectSettings is disturbed in several ways.

the last two points could be solved by changing [1] to:

        xmlString = capabilitiesDoc.toprettyxml(indent=' ', encoding='utf-8')
        xmlString = '\n'.join(line for line in xmlString.decode().split('\n') if line.strip())

But I could not get the document requested in utf-8 with correct special characters and didn't find the reason, why parts are skipped in the request answer.

If I print xmlString to the console before [2], the print output contains all the layers. But somehow they are missing within the final result.

[1] https://github.com/qwc-services/qwc-qgis-server-plugins/blob/main/wms_geotiff_output/wms_geotiff_output.py#L161-L163 [2] https://github.com/qwc-services/qwc-qgis-server-plugins/blob/main/wms_geotiff_output/wms_geotiff_output.py#L164

manisandro commented 5 days ago

Are you requesting the final result directly from the qgis server of from the ogc service? Could you submit a PR for the fixes?

danceb commented 5 days ago

Via ogc service. As I couldn't find a solution for two of the four mentioned issues, I wouldn't submit a PR at the moment ...

manisandro commented 5 days ago

It is likely the ogc service which is filtering out the layers. Try querying directly from the qgis server (you can expose the port (say to 8001) in the docker-compose.yml and query http://localhost:8001/ows/project_name?SERVICE=WMS&....

danceb commented 4 days ago

Yes, the ogc service is filtering out all the layers, which contain special characters in the layer name... But it does this only with using the "wms_geotiff_output" plugin.

I don't get it, why ...

The plugin is using import xml.dom.minidom, while the ogc service is using from xml.etree import ElementTree to handle the capabilities xml. Maybe the packages are handling the reading/saving of xml a little different?

manisandro commented 4 days ago

Can you attach or PM the two capabilities files with and without the plugin?

danceb commented 4 days ago

For sure: capabilities_xml.zip

Within the archive you can find four xml files. Direct qgis server request and via ogc service, each with and without plugin. Unfortunately, I could'nt find any key difference, besides the missing layers in ogc service with plugin ...

edit: just checked, the layers with special characters are regularly written to the ogcConfig.json and permissions.json via the config server, so the ogc service should read them correctly.