1

This question comes from my poor understanding of how GDAL/OGR is supposed to work server-side, but before trying it I'd like to know if what I want is feasible with this library.

Basically, I am developing a webGIS application where the user should interact with a WFS. I'd like to give the user the possibility to download the data from this WFS as a format that the server does not provide as output so I need to convert it first.

I need the function ogr2ogr with the WFS driver to be able to convert the GML response of the server in (e.g.) Shapefile format.

My very basic question is: how can I call ogr2ogr which is installed on my server when the user click on (e.g.) a "Download" button?

My idea obvioulsy is to tie the onclick event with a JS function that calls ogr2ogr, but here my lack of knowledge in server-side web development does not le me go on.

Am I supposed to prepare a script (like a PHP) that internally calls ogr2ogr, or should I place the GDAL/OGR executables in a cgi-bin folder so that I can point and calling them with the required parameters?

umbe1987
  • 1,542
  • 4
  • 25
  • 43

1 Answers1

1

I'd suggest investigating your server-middleware of choice; there's an excellent chance it supports OGR2OGR already if it's Open Source. The big two:

GeoServer has an ogr extension that can do what you want - https://docs.geoserver.org/stable/en/user/extensions/ogr.html

MapServer supports OGR too - https://mapserver.gis.umn.edu/output/ogr_output.html

Alternatively, you may want to consider investigating the WPS standard - but it's probably overkill if you're just changing formats.

GIS-Jonathan
  • 3,167
  • 6
  • 28
  • 42
  • Well, it's actually QGIS Server, which is quite new and not sure if it supports it. As far as I can see from its GetFeature outputFormat, it only lists GML and GeoJSON. Here is the GetCapabilities link: 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 – umbe1987 Dec 13 '18 at 19:43
  • 1
    @umbe1987 - well, QGISServer will definitely include OGR2OGR inside it, but a quick google doesn't find any obvious way to access it. Try asking on the QGIS user list - https://lists.osgeo.org/mailman/listinfo/qgis-user - or gis stackoverflow. – GIS-Jonathan Dec 13 '18 at 19:46
  • Thanks Jonathan, I will and report what I will discover. Cheers. – umbe1987 Dec 13 '18 at 19:47
  • @umbe1987 - True; but I'm already at 5.5k on GIS Stackoverflow so... ;-) – GIS-Jonathan Dec 13 '18 at 19:51
  • Just asked on GIS Stackoverflow https://gis.stackexchange.com/questions/306064/qgis-server-convert-wfs-getfeature-gml-as-shapefile-with-ogr2ogr – umbe1987 Dec 14 '18 at 11:56