0

Short

I am currently experiencing QGIS server with transactions using WFS/OAPIF, namely for doing POST requests.

To to this end, I'm using a Docker image (either [1] or [2]; the same problem as the one described below occurs with both images, but they use slightly different URLs. I will only show the logs of the first image, unless otherwise specified.).

QGIS server is hanging on this error each time I do a POST request from a client:

******************** New request *************** ... stuff WARNING [13]: attr: name=Description idx=0 value=Test 

And the PostGIS database seems to open a transaction on that request, but it never receives the statement to execute:

LOG: statement: SET extra_float_digits=3; SET application_name='QGIS3 server'; SET datestyle='ISO' LOG: statement: SET statement_timeout = 20000 LOG: statement: BEGIN TRANSACTION 

Detailed

I've successfully set up a QGIS project with some very simple PostGIS data layers (2 point layers and a polygon layer).

I configured all the services (WMS, WMTS, WFS, OAPIF) with no fancy parameters. The project is valid when I hit the Launch button in the Test Configuration section of the QGIS server tab. I can successfully access all the services, and I can see the data.

From whatever client, everything is fine for GET operations.

In order to enable transactions, I also ticked "Update / Insert / Delete" columns in the WFS/OAPIF tab (Menu: "Project > Properties > QGISSserver") in my QGIS server project:

enter image description here

So I must be able to do some transactions using one of these two services, such as creating a new feature for example.

Issues

Here are the issues with both services:

OAPIF

By using QGIS as a client, when I connect to this OAPIF endpoint in the "WFS/OGC API - Features" in the Data Manager: http://localhost:8010/wfs3/?MAP=/io/data/My_project/My_project.qgs I can successfully add my 3 layers.

But each time I click the save button to add a new feature with all of its attributes filled (e.g. a new point feature in the pt_from_csv layer) the following "Commit errors" is shown in a pop-up by QGIS:

Could not commit changes to layer pt_from_csv Errors: ERROR: 1 feature not added. 

It's not super verbose, so I checked the QGIS server logs corresponding to that request:

my_app-qgis-server-1 | 20218:47 INFO Server[13]: ******************** New request *************** my_app-qgis-server-1 | 07:18:47 INFO Server[13]: Request URL: http://localhost:8010/wfs3/?MAP=/io/data/My_project/My_project.qgs&SERVICE=WFS my_app-qgis-server-1 | 07:18:47 INFO Server[13]: Environment: my_app-qgis-server-1 | 07:18:47 INFO Server[13]: ------------------------------------------------ my_app-qgis-server-1 | 07:18:47 INFO Server[13]: SERVER_NAME: localhost my_app-qgis-server-1 | 07:18:47 INFO Server[13]: REQUEST_URI: /wfs3/?MAP=/io/data/My_project/My_project.qgs&SERVICE=WFS my_app-qgis-server-1 | 07:18:47 INFO Server[13]: SCRIPT_NAME: /qgis/qgis_mapserv.fcgi my_app-qgis-server-1 | 07:18:47 INFO Server[13]: HTTPS: my_app-qgis-server-1 | 07:18:47 INFO Server[13]: REMOTE_ADDR: 172.22.0.1 my_app-qgis-server-1 | 07:18:47 INFO Server[13]: SERVER_PORT: 8010 my_app-qgis-server-1 | 07:18:47 INFO Server[13]: QUERY_STRING: MAP=/io/data/My_project/My_project.qgs&SERVICE=WFS my_app-qgis-server-1 | 07:18:47 INFO Server[13]: CONTENT_TYPE: text/xml my_app-qgis-server-1 | 07:18:47 INFO Server[13]: REQUEST_METHOD: POST my_app-qgis-server-1 | 07:18:47 INFO Server[13]: SERVER_PROTOCOL: HTTP/1.1 my_app-qgis-server-1 | Headers: my_app-qgis-server-1 | ------------------------------------------------ my_app-qgis-server-1 | "Host" : "localhost:8010" my_app-qgis-server-1 | "User-Agent" : "Mozilla/5.0 QGIS/32806/Ubuntu 22.04.2 LTS" my_app-qgis-server-1 | 07:18:47 WARNING Server[13]: Error parsing post data as XML: at line 1, column 532: error occurred while parsing element. Assuming urlencoded query string sent in the post body. my_app-qgis-server-1 | 07:18:47 INFO Server[13]: <TRANSACTION XMLNS:"http://www.opengis.net/wfs" xsi:schemaLocation="http://www.qgis.org/gml http://localhost:8010/wfs3/?MAP=/io/data/My_project/My_project.qgs my_app-qgis-server-1 | 07:18:47 INFO Server[13]: AMP;REQUEST:DescribeFeatureType my_app-qgis-server-1 | 07:18:47 INFO Server[13]: AMP;SERVICE:WFS my_app-qgis-server-1 | 07:18:47 INFO Server[13]: AMP;TYPENAME:pt_from_csv" xmlns:gml="http://www.opengis.net/gml" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="1.1.0" service="WFS"><Insert xmlns="http://www.opengis.net/wfs"><pt_from_csv xmlns="http://www.qgis.org/gml"><Description xmlns="http://www.qgis.org/gml">Test</Description><Number_of_samples xmlns="http://www.qgis.org/gml">10</Number_of_samples><Sampling_rate_Hz xmlns="http://www.qgis.org/gml">2</Sampling_rate_Hz><Internal_ID xmlns="http://www.qgis.org/gml">fig-1552</Internal_ID><Data_grösse_Byte xmlns="http://www.qgis.org/gml">4512778</Data_grösse_Byte><State xmlns="http://www.qgis.org/gml">Zuerich</State><Year xmlns="http://www.qgis.org/gml">2022</Year><id xmlns="http://www.qgis.org/gml">1102</id><geometry xmlns="http://www.qgis.org/gml"><gml:Point srsName="EPSG:2056"><gml:pos srsDimension="2">2684331.30362764792516828 1245039.15295048733241856</gml:pos></gml:Point></geometry></pt_from_csv></Insert></Transaction> my_app-qgis-server-1 | 07:18:47 INFO Server[13]: AMP;VERSION:1.0.0 my_app-qgis-server-1 | 07:18:47 INFO Server[13]: MAP:/io/data/My_project/My_project.qgs my_app-qgis-server-1 | 07:18:47 INFO Server[13]: SERVICE:WFS my_app-qgis-server-1 | 07:18:47 WARNING Server[13]: <?xml version="1.0" encoding="UTF-8"?> my_app-qgis-server-1 | <ServiceExceptionReport version="1.2.0" xmlns="http://www.opengis.net/ogc"> my_app-qgis-server-1 | <ServiceException code="OperationNotSupported">Please add or check the value of the REQUEST parameter</ServiceException> my_app-qgis-server-1 | </ServiceExceptionReport> my_app-qgis-server-1 | my_app-qgis-server-1 | 07:18:47 INFO Server[13]: Request finished in 1 ms 

Also, there isn't any single line in the PostGIS database log. So the transaction doesn't reach the database.

WFS

Now, when I connect to the WFS endpoint in the "WFS/OGC API - Features" in the Data Manager: http://localhost:8010/ogc/My_project?SERVICE=WFS&REQUEST=GetCapabilities (which is a proxy of http://localhost:8010/ogc/?map=/io/data/My_project/My_project.qgs&SERVICE=WFS&Request=GetCapabilities) I can also add my 3 layers successfully.

But each time I click the save button to add a new feature with all of its attributes filled (e.g. a point feature in the pt_from_csv layer) QGIS freezes for at least 1 minute (absolutely nothing responds), then it shows the same "Commit errors" pop-up as before, along with a network error:

WARNING Network request http://localhost:8010/ogc/My_project?SERVICE=WFS timed out 

This is the QGIS server log corresponding to that request:

my_app-qgis-server-1 | 07:49:10 INFO Server[13]: ******************** New request *************** my_app-qgis-server-1 | 07:49:10 INFO Server[13]: Request URL: http://localhost:8010/ogc/My_project?map=/io/data/My_project/My_project.qgs&SERVICE=WFS my_app-qgis-server-1 | 07:49:10 INFO Server[13]: Environment: my_app-qgis-server-1 | 07:49:10 INFO Server[13]: ------------------------------------------------ my_app-qgis-server-1 | 07:49:10 INFO Server[13]: SERVER_NAME: localhost my_app-qgis-server-1 | 07:49:10 INFO Server[13]: REQUEST_URI: /ogc/My_project?SERVICE=WFS my_app-qgis-server-1 | 07:49:10 INFO Server[13]: SCRIPT_NAME: /qgis/qgis_mapserv.fcgi my_app-qgis-server-1 | 07:49:10 INFO Server[13]: HTTPS: my_app-qgis-server-1 | 07:49:10 INFO Server[13]: REMOTE_ADDR: 172.31.0.1 my_app-qgis-server-1 | 07:49:10 INFO Server[13]: SERVER_PORT: 8010 my_app-qgis-server-1 | 07:49:10 INFO Server[13]: QUERY_STRING: map=/io/data/My_project/My_project.qgs&SERVICE=WFS my_app-qgis-server-1 | 07:49:10 INFO Server[13]: CONTENT_TYPE: text/xml my_app-qgis-server-1 | 07:49:10 INFO Server[13]: REQUEST_METHOD: POST my_app-qgis-server-1 | 07:49:10 INFO Server[13]: SERVER_PROTOCOL: HTTP/1.1 my_app-qgis-server-1 | Headers: my_app-qgis-server-1 | ------------------------------------------------ my_app-qgis-server-1 | "Host" : "localhost:8010" my_app-qgis-server-1 | "User-Agent" : "Mozilla/5.0 QGIS/32806/Ubuntu 22.04.2 LTS" my_app-qgis-server-1 | 07:49:10 INFO Server[13]: MAP:/io/data/My_project/My_project.qgs my_app-qgis-server-1 | 07:49:10 INFO Server[13]: REQUEST:Transaction my_app-qgis-server-1 | 07:49:10 INFO Server[13]: REQUEST_BODY:<Transaction xmlns="http://www.opengis.net/wfs" version="1.1.0" xmlns:gml="http://www.opengis.net/gml" service="WFS" xsi:schemaLocation="http://www.qgis.org/gml http://localhost:8010/ogc/My_project?SERVICE=WFS&amp;REQUEST=DescribeFeatureType&amp;VERSION=1.0.0&amp;TYPENAME=pt_from_csv" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"><Insert xmlns="http://www.opengis.net/wfs"><pt_from_csv xmlns="http://www.qgis.org/gml"><Description xmlns="http://www.qgis.org/gml">Test</Description><Number_of_samples xmlns="http://www.qgis.org/gml">10</Number_of_samples><Sampling_rate_Hz xmlns="http://www.qgis.org/gml">2</Sampling_rate_Hz><Internal_ID xmlns="http://www.qgis.org/gml">fid-1009</Internal_ID><Data_grösse_Byte xmlns="http://www.qgis.org/gml">4678211</Data_grösse_Byte><State xmlns="http://www.qgis.org/gml">Zuerich</State><Year xmlns="http://www.qgis.org/gml">2022</Year><id xmlns="http://www.qgis.org/gml">1101</id><geometry xmlns="http://www.qgis.org/gml"><gml:Point srsName="EPSG:2056"><gml:pos srsDimension="2">2684037.25046077255400062 1244792.54637890809139609</gml:pos></gml:Point></geometry></pt_from_csv></Insert></Transaction> my_app-qgis-server-1 | 07:49:10 INFO Server[13]: SCHEMALOCATION:http://www.qgis.org/gml http://localhost:8010/ogc/My_project?SERVICE=WFS&REQUEST=DescribeFeatureType&VERSION=1.0.0&TYPENAME=pt_from_csv my_app-qgis-server-1 | 07:49:10 INFO Server[13]: SERVICE:WFS my_app-qgis-server-1 | 07:49:10 INFO Server[13]: VERSION:1.1.0 my_app-qgis-server-1 | proj_create: Error 1029 (File not found or invalid): pipeline: Pipeline: Bad step definition: proj=hgridshift (File not found or invalid) my_app-qgis-server-1 | 07:49:10 WARNING [13]: attr: name=Description idx=0 value=Test 

After that very last WARNING line, the QGIS server docker service becomes definitely unresponsive, that means I have to shut it down and re-up it again.

But now, the database logs show something:

my_app-db-1 | 2023-05-11 07:49:10.710 UTC [886] LOG: statement: SELECT regclass('pg_class')::oid AS oidselect;BEGIN;DECLARE oidcursor BINARY CURSOR FOR SELECT regclass('pg_class')::oid AS oidbinarycursor;FETCH FORWARD 1 FROM oidcursor;CLOSE oidcursor;COMMIT; my_app-db-1 | 2023-05-11 07:49:10.710 UTC [886] LOG: statement: SELECT postgis_version() my_app-db-1 | 2023-05-11 07:49:10.716 UTC [886] LOG: statement: SELECT postgis_geos_version(), postgis_proj_version() my_app-db-1 | 2023-05-11 07:49:10.716 UTC [886] LOG: statement: SELECT has_schema_privilege(n.oid, 'usage') AND has_table_privilege(t.oid, 'select') AND has_table_privilege(l.oid, 'select') FROM pg_namespace n, pg_class t, pg_class l WHERE n.nspname = 'topology' AND t.relnamespace = n.oid AND l.relnamespace = n.oid AND t.relname = 'topology' AND l.relname = 'layer' my_app-db-1 | 2023-05-11 07:49:10.717 UTC [886] LOG: statement: SELECT has_table_privilege(c.oid, 'select') AND has_table_privilege(f.oid, 'select') FROM pg_class c, pg_class f, pg_namespace n, pg_extension e WHERE c.relnamespace = n.oid AND c.relname = 'pointcloud_columns' AND f.relnamespace = n.oid AND f.relname = 'pointcloud_formats' AND n.oid = e.extnamespace AND e.extname = 'pointcloud' my_app-db-1 | 2023-05-11 07:49:10.717 UTC [886] LOG: statement: SELECT has_table_privilege(c.oid, 'select') FROM pg_class c, pg_namespace n, pg_type t WHERE c.relnamespace = n.oid AND n.oid = t.typnamespace AND c.relname = 'raster_columns' AND t.typname = 'raster' my_app-db-1 | 2023-05-11 07:49:10.717 UTC [886] LOG: statement: SET extra_float_digits=3; SET application_name='QGIS3 server'; SET datestyle='ISO' my_app-db-1 | 2023-05-11 07:49:10.717 UTC [886] LOG: statement: SET statement_timeout = 20000 my_app-db-1 | 2023-05-11 07:49:10.717 UTC [886] LOG: statement: BEGIN TRANSACTION 

but it hangs on forever at this point.

Also, the web server (nginx) shows:

[error] 29#29: *62 upstream timed out (110: Connection timed out) while reading response header from upstream, client: 172.22.0.1, server: _, request: "POST /ogc/My_project?SERVICE=WFS HTTP/1.1", upstream: "fastcgi://172.22.0.3:9993", host: "localhost:8010" 

And with the camptocamp Docker image, the embedded web server (Apache/2.4.52 (Ubuntu) mod_fcgid/2.3.9 configured) shows some kind of same timeout signs:

my_app-c2c-qgis | [warn] [pid 14] mod_fcgid: read data timeout in 40 seconds my_app-c2c-qgis | [error] [pid 14] End of script output before headers: qgis-mapserv-wrapper my_app-c2c-qgis | 40046815 - 172.31.0.1 - - [11/May/2023:07:45:10 +0000] "POST /?MAP=/etc/qgisserver/My_project/My_project.qgs&SERVICE=WFS HTTP/1.1" 500 801 "-" "Mozilla/5.0 QGIS/32806/Ubuntu 22.04.2 LTS" my_app-c2c-qgis | [warn] [pid 12] mod_fcgid: process 69 graceful kill fail, sending SIGKILL 

Question

How can I make either the WFS or the OAPIF endpoint work for transactions?

4
  • OGC API Features standard does not support transactions yet. You can follow the development of the standard here github.com/opengeospatial/ogcapi-features/tree/master/…. WFS-T should work, but there is something wrong with your installation, and that has to do with coordinate systems and Proj. Read the error proj_create: Error 1029 (File not found or invalid): pipeline: Pipeline: Bad step definition: proj=hgridshift (File not found or invalid) Commented May 11, 2023 at 8:44
  • You are perfectly right about the OAPIF, that's probably why it doesn't work. The issue with the WFS may be due to proj, indeed, but curiously, I do not see any projection related issues or error with the c2c image.... I will continue investigating in that direction. Commented May 11, 2023 at 8:57
  • The geometry in the insert is in EPSG:2056. Is that the native SRS of the feature type? Commented May 11, 2023 at 10:44
  • Yes the SRID reported by PostGIS is 2056. I also have to say that the same hgridshift error is shown in the c2c Docker image. I simply missed it before. So the two images are consistent. Commented May 12, 2023 at 9:29

0

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.