<html>
  <head>

    <meta http-equiv="content-type" content="text/html; charset=UTF-8">
  </head>
  <body>
    Hi list,<br>
    <br>
    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.<br>
    <br>
    A similar REST service served with pg_featureserv, works well...<br>
    <h3 dir="auto">Here are tests realised with curl and ogrinfo for
      failing postgrest service and working pg_featureserv services :</h3>
    <h4 dir="auto">PostGrest</h4>
    <h5 dir="auto">curl answer :</h5>
    <div class="snippet-clipboard-content position-relative
      overflow-auto">
      <pre><code>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
</code></pre>
    </div>
    <h5 dir="auto">ogrinfo answer :</h5>
    <div class="snippet-clipboard-content position-relative
      overflow-auto">
      <pre><code>ERROR 1: HTTP error code : 404
ERROR 1: HTTP error code : 404
FAILURE:
Unable to open datasource `<a class="moz-txt-link-freetext" href="http://mydomain:3000/rpc/wod_geojson.json">http://mydomain:3000/rpc/wod_geojson.json</a>' with the following drivers...
</code></pre>
    </div>
    <h4 dir="auto">pg_featureserv</h4>
    <h5 dir="auto">curl answer :</h5>
    <div class="snippet-clipboard-content position-relative
      overflow-auto">
      <pre><code>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
</code></pre>
    </div>
    <h5 dir="auto">ogrinfo answer :</h5>
    <div class="snippet-clipboard-content position-relative
      overflow-auto">
      <pre><code>INFO: Open of `<a class="moz-txt-link-freetext" href="http://mydomain:9000/functions/webmapod_mdarret/items.json">http://mydomain:9000/functions/webmapod_mdarret/items.json</a>'
      using driver `GeoJSON' successful.
1: items (Point)
</code></pre>
    </div>
    <p dir="auto">What could explain that 404 error for posgrest geojson
      web service ?<br>
    </p>
    <p dir="auto">Thanks for any hint,<br>
    </p>
    <pre class="moz-signature" cols="72">-- 
Christophe Damour
</pre>
  </body>
</html>