Re: [gdal-dev] Can't open postgrest service with ogr2ogr (via QGIS)
And I finally discovered that I can load my geojson webservice in QGIS from Python : myLayer= QgsVectorLayer('http://mydomain:3000/rpc/wod_geojson, 'myLayer', 'ogr') QgsProject.instance().addMapLayers([myLayer]) But still not from QGIS UI... -- Christophe Damour Le 15/02/2022 à 10:38, SIGéal a écrit : I managed to have ogrinfo working by adding "Accept: application/json" header using GDAL_HTTP_HEADER_FILE. Now the problem is I can't do that with QGIS... -- Christophe Damour Le 15/02/2022 à 08:46, Rahkonen Jukka (MML) a écrit : Hi, I wonder if there could be something in the Accept headers that orginfo is using. Ogrinfo seems to set headers “Accept: text/plain, application/json” but GeoJSON is now officially “application/geo+json”. I do not know the hierarchy of the MIME types and if “json” should include also the subtype “geo+json”. I made a test with ogrinfo and --config GDAL_HTTP_HEADER_FILE my_headers.txt. After this I could see from the logs this Accept: application/geo+json Accept: text/plain, application/json By https://datatracker.ietf.org/doc/html/rfc2616/ I suppose this is correct and http server should concatenate Accept headers. However, the test was not successful so maybe there is something else going wrong. -Jukka Rahkonen- ___ gdal-dev mailing list gdal-dev@lists.osgeo.org https://lists.osgeo.org/mailman/listinfo/gdal-dev
Re: [gdal-dev] Can't open postgrest service with ogr2ogr (via QGIS)
I managed to have ogrinfo working by adding "Accept: application/json" header using GDAL_HTTP_HEADER_FILE. Now the problem is I can't do that with QGIS... -- Christophe Damour Le 15/02/2022 à 08:46, Rahkonen Jukka (MML) a écrit : Hi, I wonder if there could be something in the Accept headers that orginfo is using. Ogrinfo seems to set headers “Accept: text/plain, application/json” but GeoJSON is now officially “application/geo+json”. I do not know the hierarchy of the MIME types and if “json” should include also the subtype “geo+json”. I made a test with ogrinfo and --config GDAL_HTTP_HEADER_FILE my_headers.txt. After this I could see from the logs this Accept: application/geo+json Accept: text/plain, application/json By https://datatracker.ietf.org/doc/html/rfc2616/ I suppose this is correct and http server should concatenate Accept headers. However, the test was not successful so maybe there is something else going wrong. -Jukka Rahkonen- ___ gdal-dev mailing list gdal-dev@lists.osgeo.org https://lists.osgeo.org/mailman/listinfo/gdal-dev
Re: [gdal-dev] Can't open postgrest service with ogr2ogr (via QGIS)
Hi, I wonder if there could be something in the Accept headers that orginfo is using. Ogrinfo seems to set headers “Accept: text/plain, application/json” but GeoJSON is now officially “application/geo+json”. I do not know the hierarchy of the MIME types and if “json” should include also the subtype “geo+json”. I made a test with ogrinfo and --config GDAL_HTTP_HEADER_FILE my_headers.txt. After this I could see from the logs this Accept: application/geo+json Accept: text/plain, application/json By https://datatracker.ietf.org/doc/html/rfc2616/ I suppose this is correct and http server should concatenate Accept headers. However, the test was not successful so maybe there is something else going wrong. -Jukka Rahkonen- ___ gdal-dev mailing list gdal-dev@lists.osgeo.org https://lists.osgeo.org/mailman/listinfo/gdal-dev
Re: [gdal-dev] Can't open postgrest service with ogr2ogr (via QGIS)
Thanks for your answer. The url works fine in a browser. Here is what "ogrinfo --debug on" returns : GDAL: Auto register C:\Program Files\QGIS 3.16.16\bin\gdalplugins\gdal_ECW_JP2ECW.dll using GDALRegister_ECW_JP2ECW. GDAL: Auto register C:\Program Files\QGIS 3.16.16\bin\gdalplugins\gdal_GEOR.dll using GDALRegister_GEOR. GDAL: Auto register C:\Program Files\QGIS 3.16.16\bin\gdalplugins\gdal_HDF5.dll using GDALRegister_HDF5. GDAL: Auto register C:\Program Files\QGIS 3.16.16\bin\gdalplugins\gdal_MG4Lidar.dll using GDALRegister_MG4Lidar. GDAL: Auto register C:\Program Files\QGIS 3.16.16\bin\gdalplugins\gdal_MrSID.dll using GDALRegister_MrSID. GDAL: Auto register C:\Program Files\QGIS 3.16.16\bin\gdalplugins\ogr_OCI.dll using RegisterOGROCI. GDAL: Auto register C:\Program Files\QGIS 3.16.16\bin\gdalplugins\ogr_SOSI.dll using RegisterOGRSOSI. HTTP: Fetch(http://mydomain:3000/rpc/wod_geojson.json) HTTP: libcurl/7.75.0 OpenSSL/1.1.1l zlib/1.2.11 WinIDN HTTP: These HTTP headers were set: Accept: text/plain, application/json ERROR 1: HTTP error code : 404 HTTP: Fetch(http://mydomain:3000/rpc/wod_geojson.json) HTTP: These HTTP headers were set: Accept: text/plain, application/json ERROR 1: HTTP error code : 404 FAILURE: Unable to open datasource `http://sigeal.net:3000/rpc/wod_geojson.json' with the following drivers... Weird -- Christophe Damour Le 14/02/2022 à 20:26, Rahkonen Jukka (MML) a écrit : 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 *Puolesta *SIGéal *Lähetetty:* maanantai 14. helmikuuta 2022 20.54 *Vastaanottaja:* gdal-dev@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 ___ gdal-dev mailing list gdal-dev@lists.osgeo.org https://lists.osgeo.org/mailman/listinfo/gdal-dev
Re: [gdal-dev] Can't open postgrest service with ogr2ogr (via QGIS)
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 Puolesta SIGéal Lähetetty: maanantai 14. helmikuuta 2022 20.54 Vastaanottaja: gdal-dev@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 ___ gdal-dev mailing list gdal-dev@lists.osgeo.org https://lists.osgeo.org/mailman/listinfo/gdal-dev
[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 ___ gdal-dev mailing list gdal-dev@lists.osgeo.org https://lists.osgeo.org/mailman/listinfo/gdal-dev