[gdal-dev] Can't open postgrest service with ogr2ogr (via QGIS)

Rahkonen Jukka (MML) jukka.rahkonen at maanmittauslaitos.fi
Mon Feb 14 11:26:45 PST 2022


Hi,

Does http://mydomain:3000/rpc/wod_geojson.json return data if you send it with browser?  Re-run the ogrinfo command with “--debug on” and see if you can capture the http requests that ogrinfo sends.

-Jukka Rahkonen-

Lähettäjä: gdal-dev <gdal-dev-bounces at lists.osgeo.org> Puolesta SIGéal
Lähetetty: maanantai 14. helmikuuta 2022 20.54
Vastaanottaja: gdal-dev at lists.osgeo.org
Aihe: [gdal-dev] Can't open postgrest service with ogr2ogr (via QGIS)

Hi list,

I have a PostgreSql stored procedure which returns a geojson feature collection created with json_build_object function. This web service opens fine in OpenLayers, however, when I try to open it in QGIS, with data source manager -> vector -> protocol -> geojson.

A similar REST service served with pg_featureserv, works well...
Here are tests realised with curl and ogrinfo for failing postgrest service and working pg_featureserv services :
PostGrest
curl answer :

StatusCode        : 200

StatusDescription : OK

Content           : {123, 34, 116, 121...}

RawContent        : HTTP/1.1 200 OK

                    Transfer-Encoding: chunked

                    Content-Range: 0-0/*

                    Vary: Accept-Encoding

                    Content-Type: application/geo+json

                    Date: Sun, 13 Feb 2022 07:35:55 GMT

                    Server: postgrest/9.0.0



                    {"type" : ...

Headers           : {[Transfer-Encoding, chunked], [Content-Range, 0-0/*], [Vary, Accept-Encoding], [Content-Type,

                    application/geo+json]...}

RawContentLength  : 430979

ogrinfo answer :

ERROR 1: HTTP error code : 404

ERROR 1: HTTP error code : 404

FAILURE:

Unable to open datasource `http://mydomain:3000/rpc/wod_geojson.json' with the following drivers...

pg_featureserv
curl answer :

StatusCode        : 200

StatusDescription : OK

Content           : {123, 34, 116, 121...}

RawContent        : HTTP/1.1 200 OK

                    Transfer-Encoding: chunked

                    Content-Type: application/geo+json

                    Date: Sun, 13 Feb 2022 07:33:51 GMT



                    {"type":"FeatureCollection","features":[{"type":"Feature","geometry":{"type":"Po...

Headers           : {[Transfer-Encoding, chunked], [Content-Type, application/geo+json], [Date, Sun, 13 Feb 2022

                    07:33:51 GMT]}

RawContentLength  : 4474

ogrinfo answer :

INFO: Open of `http://mydomain:9000/functions/webmapod_mdarret/items.json'

      using driver `GeoJSON' successful.

1: items (Point)

What could explain that 404 error for posgrest geojson web service ?

Thanks for any hint,

--

Christophe Damour
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/gdal-dev/attachments/20220214/8e9d3083/attachment.html>


More information about the gdal-dev mailing list