<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="Generator" content="Microsoft Word 15 (filtered medium)">
<style><!--
/* Font Definitions */
@font-face
        {font-family:"Cambria Math";
        panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
        {font-family:Consolas;
        panose-1:2 11 6 9 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0cm;
        font-size:11.0pt;
        font-family:"Calibri",sans-serif;}
h3
        {mso-style-priority:9;
        mso-style-link:"Otsikko 3 Char";
        mso-margin-top-alt:auto;
        margin-right:0cm;
        mso-margin-bottom-alt:auto;
        margin-left:0cm;
        font-size:13.5pt;
        font-family:"Calibri",sans-serif;
        font-weight:bold;}
h4
        {mso-style-priority:9;
        mso-style-link:"Otsikko 4 Char";
        mso-margin-top-alt:auto;
        margin-right:0cm;
        mso-margin-bottom-alt:auto;
        margin-left:0cm;
        font-size:12.0pt;
        font-family:"Calibri",sans-serif;
        font-weight:bold;}
h5
        {mso-style-priority:9;
        mso-style-link:"Otsikko 5 Char";
        mso-margin-top-alt:auto;
        margin-right:0cm;
        mso-margin-bottom-alt:auto;
        margin-left:0cm;
        font-size:10.0pt;
        font-family:"Calibri",sans-serif;
        font-weight:bold;}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:blue;
        text-decoration:underline;}
code
        {mso-style-priority:99;
        font-family:"Courier New";}
pre
        {mso-style-priority:99;
        mso-style-link:"HTML-esimuotoiltu Char";
        margin:0cm;
        font-size:10.0pt;
        font-family:"Courier New";}
span.Otsikko3Char
        {mso-style-name:"Otsikko 3 Char";
        mso-style-priority:9;
        mso-style-link:"Otsikko 3";
        font-family:"Calibri Light",sans-serif;
        color:#1F3763;}
span.Otsikko4Char
        {mso-style-name:"Otsikko 4 Char";
        mso-style-priority:9;
        mso-style-link:"Otsikko 4";
        font-family:"Calibri Light",sans-serif;
        color:#2F5496;
        font-style:italic;}
span.Otsikko5Char
        {mso-style-name:"Otsikko 5 Char";
        mso-style-priority:9;
        mso-style-link:"Otsikko 5";
        font-family:"Calibri Light",sans-serif;
        color:#2F5496;}
span.HTML-esimuotoiltuChar
        {mso-style-name:"HTML-esimuotoiltu Char";
        mso-style-priority:99;
        mso-style-link:HTML-esimuotoiltu;
        font-family:Consolas;}
span.Shkpostityyli25
        {mso-style-type:personal-reply;
        font-family:"Calibri",sans-serif;
        color:windowtext;}
.MsoChpDefault
        {mso-style-type:export-only;
        font-size:10.0pt;}
@page WordSection1
        {size:612.0pt 792.0pt;
        margin:70.85pt 2.0cm 70.85pt 2.0cm;}
div.WordSection1
        {page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
</head>
<body lang="FI" link="blue" vlink="purple" style="word-wrap:break-word">
<div class="WordSection1">
<p class="MsoNormal"><span style="mso-fareast-language:EN-US">Hi,<o:p></o:p></span></p>
<p class="MsoNormal"><span style="mso-fareast-language:EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="mso-fareast-language:EN-US">Does <a href="http://mydomain:3000/rpc/wod_geojson.json">
http://mydomain:3000/rpc/wod_geojson.json</a> 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.<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="mso-fareast-language:EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="mso-fareast-language:EN-US">-Jukka Rahkonen-<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="mso-fareast-language:EN-US"><o:p> </o:p></span></p>
<div>
<div style="border:none;border-top:solid #E1E1E1 1.0pt;padding:3.0pt 0cm 0cm 0cm">
<p class="MsoNormal"><b><span lang="EN-US">Lähettäjä:</span></b><span lang="EN-US"> gdal-dev <gdal-dev-bounces@lists.osgeo.org>
<b>Puolesta </b>SIGéal<br>
<b>Lähetetty:</b> maanantai 14. helmikuuta 2022 20.54<br>
<b>Vastaanottaja:</b> gdal-dev@lists.osgeo.org<br>
<b>Aihe:</b> [gdal-dev] Can't open postgrest service with ogr2ogr (via QGIS)<o:p></o:p></span></p>
</div>
</div>
<p class="MsoNormal"><span lang="EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal">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...<o:p></o:p></p>
<h3>Here are tests realised with curl and ogrinfo for failing postgrest service and working pg_featureserv services :<o:p></o:p></h3>
<h4>PostGrest<o:p></o:p></h4>
<h5>curl answer :<o:p></o:p></h5>
<div>
<pre><code>StatusCode        : 200<o:p></o:p></code></pre>
<pre><code>StatusDescription : OK<o:p></o:p></code></pre>
<pre><code>Content           : {123, 34, 116, 121...}<o:p></o:p></code></pre>
<pre><code>RawContent        : HTTP/1.1 200 OK<o:p></o:p></code></pre>
<pre><code>                    Transfer-Encoding: chunked<o:p></o:p></code></pre>
<pre><code>                    Content-Range: 0-0/*<o:p></o:p></code></pre>
<pre><code>                    Vary: Accept-Encoding<o:p></o:p></code></pre>
<pre><code>                    Content-Type: application/geo+json<o:p></o:p></code></pre>
<pre><code>                    Date: Sun, 13 Feb 2022 07:35:55 GMT<o:p></o:p></code></pre>
<pre><code>                    Server: postgrest/9.0.0<o:p></o:p></code></pre>
<pre><code>                    <o:p></o:p></code></pre>
<pre><code>                    {"type" : ...<o:p></o:p></code></pre>
<pre><code>Headers           : {[Transfer-Encoding, chunked], [Content-Range, 0-0/*], [Vary, Accept-Encoding], [Content-Type, <o:p></o:p></code></pre>
<pre><code>                    application/geo+json]...}<o:p></o:p></code></pre>
<pre><code>RawContentLength  : 430979<o:p></o:p></code></pre>
</div>
<h5>ogrinfo answer :<o:p></o:p></h5>
<div>
<pre><code>ERROR 1: HTTP error code : 404<o:p></o:p></code></pre>
<pre><code>ERROR 1: HTTP error code : 404<o:p></o:p></code></pre>
<pre><code>FAILURE:<o:p></o:p></code></pre>
<pre><code>Unable to open datasource `<a href="http://mydomain:3000/rpc/wod_geojson.json">http://mydomain:3000/rpc/wod_geojson.json</a>' with the following drivers...<o:p></o:p></code></pre>
</div>
<h4>pg_featureserv<o:p></o:p></h4>
<h5>curl answer :<o:p></o:p></h5>
<div>
<pre><code>StatusCode        : 200<o:p></o:p></code></pre>
<pre><code>StatusDescription : OK<o:p></o:p></code></pre>
<pre><code>Content           : {123, 34, 116, 121...}<o:p></o:p></code></pre>
<pre><code>RawContent        : HTTP/1.1 200 OK<o:p></o:p></code></pre>
<pre><code>                    Transfer-Encoding: chunked<o:p></o:p></code></pre>
<pre><code>                    Content-Type: application/geo+json<o:p></o:p></code></pre>
<pre><code>                    Date: Sun, 13 Feb 2022 07:33:51 GMT<o:p></o:p></code></pre>
<pre><code>                    <o:p></o:p></code></pre>
<pre><code>                    {"type":"FeatureCollection","features":[{"type":"Feature","geometry":{"type":"Po...<o:p></o:p></code></pre>
<pre><code>Headers           : {[Transfer-Encoding, chunked], [Content-Type, application/geo+json], [Date, Sun, 13 Feb 2022 <o:p></o:p></code></pre>
<pre><code>                    07:33:51 GMT]}<o:p></o:p></code></pre>
<pre><code>RawContentLength  : 4474<o:p></o:p></code></pre>
</div>
<h5>ogrinfo answer :<o:p></o:p></h5>
<div>
<pre><code>INFO: Open of `<a href="http://mydomain:9000/functions/webmapod_mdarret/items.json">http://mydomain:9000/functions/webmapod_mdarret/items.json</a>'<o:p></o:p></code></pre>
<pre><code>      using driver `GeoJSON' successful.<o:p></o:p></code></pre>
<pre><code>1: items (Point)<o:p></o:p></code></pre>
</div>
<p>What could explain that 404 error for posgrest geojson web service ?<o:p></o:p></p>
<p>Thanks for any hint,<o:p></o:p></p>
<pre>-- <o:p></o:p></pre>
<pre>Christophe Damour<o:p></o:p></pre>
</div>
</body>
</html>