[gdal-dev] ogr2ogr and wfs driver with POST requests

Even Rouault even.rouault at spatialys.com
Wed Dec 26 10:16:21 PST 2018


On mercredi 26 décembre 2018 09:56:48 CET umbertofilippo wrote:
> Is it possible to use the WFS driver of ogr2ogr with POST reuqests?

No, it uses GET verb for GetCapabilities, DescribeFeatureType and GetFeature.
It uses POST for the transactional part only.

But it is not difficult to translate your POST feature request into a GET one.
Or you can use your existing code to download the GetFeature response and use 
the resulting GML file as the input of ogr2ogr.

Even

> 
> I am actually creating my Getfeature requests with OpenLayers using the
> function  ol/format/WFS~WFS/writeGetFeature
> <https://openlayers.org/en/latest/apidoc/module-ol_format_WFS-WFS.html#write
> GetFeature> .
> 
> This returns the Node of my getFeature request, but I don't know if I can
> use it along with ogr2ogr.
> 
> So far I've tested ogr2ogr successfully with GET requests but I would need
> to use it with POST possibly.
> 
> In my code I usually to use the resulting Node from writeGetFeature to fetch
> my WFS url with POST method and the result in the body parameter (with
> JavaScript):
> 
> var featureRequest = new WFS().writeGetFeature({
>     featureNS: 'http://www.qgis.org/gml',
>     featureTypes: [typename],
>     filter: filter,
> });
> 
> // then post the request and add the received features to a layer
> var response = await fetch(url, {
>     method: 'POST',
>     body: new XMLSerializer().serializeToString(featureRequest),
> });
> 
> 
> 
> --
> Sent from: http://osgeo-org.1560.x6.nabble.com/GDAL-Dev-f3742093.html
> _______________________________________________
> gdal-dev mailing list
> gdal-dev at lists.osgeo.org
> https://lists.osgeo.org/mailman/listinfo/gdal-dev


-- 
Spatialys - Geospatial professional services
http://www.spatialys.com


More information about the gdal-dev mailing list