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

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

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

umbertofilippo
Is it possible to use the WFS driver of ogr2ogr with POST reuqests?

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#writeGetFeature>
.

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
[hidden email]
https://lists.osgeo.org/mailman/listinfo/gdal-dev
Reply | Threaded
Open this post in threaded view
|

Re: ogr2ogr and wfs driver with POST requests

Even Rouault-2
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
> [hidden email]
> https://lists.osgeo.org/mailman/listinfo/gdal-dev


--
Spatialys - Geospatial professional services
http://www.spatialys.com
_______________________________________________
gdal-dev mailing list
[hidden email]
https://lists.osgeo.org/mailman/listinfo/gdal-dev
Reply | Threaded
Open this post in threaded view
|

Re: ogr2ogr and wfs driver with POST requests

umbertofilippo
Even Rouault-2 wrote
> On mercredi 26 d├ęcembre 2018 09:56:48 CET umbertofilippo wrote:
> But it is not difficult to translate your POST feature request into a GET
> one.

Yeah, indeed I did that and that was pretty easy.
Thank you for taking the time to answering me, really appreciate it!



--
Sent from: http://osgeo-org.1560.x6.nabble.com/GDAL-Dev-f3742093.html
_______________________________________________
gdal-dev mailing list
[hidden email]
https://lists.osgeo.org/mailman/listinfo/gdal-dev