I'd like to use ogr2ogr with the WFS driver to convert the GML response of my QGIS Server 3.4.2 GetFeature layer into Shapefile. I have to do this from a WebGIS JavaScript application I am developing, via (e.g.) a click event on a "Download" button.
First of all, is there a way to do this with QGIS Server itself without implementing this functionality myself (I cannot see any outputFormat
for Shapefile)?
If this Scenario (let's call it Scenario 1) is not possible, I thought about two alternatives, and I'd like to ask which should be the best.
- Scenario 2: using PHP exec() like explained here
- Scenario 3: using the node.js ogr2ogr wrapper found in this repo
Here is the GetCapabilities of my WFS: https://www.wondermap.it/cgi-bin/qgis_mapserv.fcgi?&map=/home/ubuntu/qgis/projects/Demo_sci_WMS/demo_sci.qgs&SERVICE=WFS&VERSION=1.1.0&REQUEST=GetCapabilities
Best Answer
Check the service with ogrinfo
Result:
Find summary of one layer
Result
Get features with BBOX and save into shapefile
Check what you got
For attribute queries use ogr2ogr with -where or -sql as documented https://www.gdal.org/ogr2ogr.html. I suggest to read also the WFS driver manual https://gdal.org/drivers/vector/wfs.html.