1

I'm attempting to use QGIS Server 3.18.1 to serve feature data via the new "WFS3" OGC Features API. I successfully installed the server by following the manual and using the referenced training data (https://github.com/qgis/QGIS-Training-Data/archive/v2.0.zip, world.qgs project, naturalearth.sqlite dataset) I can successfully interact with data at http://localhost:8000/qgisserver/wfs3/collections?

However I have not been able to access PostgreSQL layers through the Features API and from the logs it's not clear why. The layers simply aren't returned by the /collections endpoint. The same layers are available through QGIS Server's WMS interface, so I know that they are configured correctly in the project file and that the server has access to the database.

The only clue in the log is here:

INFO Server[94]: Using configuration file path from environment: /home/qgis/projects/pg-manual.qgs
WARNING PostGIS[94]: NOTICE: row number 0 is out of range 0..-1

Is there some technical reason why QGIS Server's OGC Features API implementation is currently unable to serve layers from PostgreSQL, even though they are available through WMS? If not, how can I further debug the issue here?

Vince
  • 20,017
  • 15
  • 45
  • 64
tomfumb
  • 3,678
  • 1
  • 31
  • 59
  • Do you use a view? Are you sure, you have a primary key? Question related to https://github.com/qgis/QGIS/issues/32523 mentioning the same error on Desktop QGIS Only a clue. – ThomasG77 May 14 '21 at 09:52
  • PS: Forgot to say I got a working "WFS3" OGC Features API with a layer based on PostGIS. Nearly sure, you already done it but did you also tick the WFS part in QGIS Server tab when opening the project on the QGIS Desktop? – ThomasG77 May 14 '21 at 10:04
  • @ThomasG77 thanks a bunch - the WFS publish checkbox was the issue. I'm actually generating the project file in pyqgis so it wasn't quite as simple as checking the box, but I found guidance on including the WFS publish step in pyqgis here: https://gis.stackexchange.com/a/362933/2788. If you can add your suggestion as an answer I will mark it accepted – tomfumb May 14 '21 at 16:26
  • 1
    I was the guy who also answered the related question you mentioned ;) – ThomasG77 May 14 '21 at 17:16

1 Answers1

2

You need to tick the WFS layer checkbox in "Published" column when you go to "Project" > "Properties" then in tab "QGIS Server" like illustrated for "airports2" layer.

QGIS Server WFS configuration

ThomasG77
  • 30,725
  • 1
  • 53
  • 93