<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  </head>
  <body>
    <font size="2"><font face="Courier New, Courier, monospace">Thank
        you, Jukka. I did that and worked. I also had another case where
        it is important to get this right. It is when the total number
        of features exposed by the service exceeds the maximum number of
        features allowed to be fetched in one request (CountDefault). In
        this case it is also important to set the paging to NO, in
        addition with an adequate OGR_WFS_PAGE_SIZE so that the layer
        can be downloaded entirely, in several pages, without hitting
        the limit.<br>
        <br>
        Best<br>
        <br>
        Hernán<br>
        <br>
      </font></font><br>
    <div class="moz-cite-prefix">Den 2021-11-30 kl. 08:59, skrev
      Rahkonen Jukka (MML):<br>
    </div>
    <blockquote type="cite"
      cite="mid:a69102cf67d048f4aa7daf3ab5816b2e@maanmittauslaitos.fi">
      <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
      <meta name="Generator" content="Microsoft Word 15 (filtered
        medium)">
      <style>@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;}p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0cm;
        font-size:11.0pt;
        font-family:"Calibri",sans-serif;}a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:blue;
        text-decoration:underline;}span.Shkpostityyli19
        {mso-style-type:personal-compose;
        font-family:"Calibri",sans-serif;
        color:windowtext;}.MsoChpDefault
        {mso-style-type:export-only;
        font-size:10.0pt;}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]-->
      <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 style="mso-fareast-language:EN-US"
            lang="EN-US">There is something about WFS 2 and paging in
            <a href="https://gdal.org/drivers/vector/wfs.html"
              moz-do-not-send="true" class="moz-txt-link-freetext">https://gdal.org/drivers/vector/wfs.html</a><o:p></o:p></span></p>
        <p class="MsoNormal"><span style="mso-fareast-language:EN-US"
            lang="EN-US"><o:p> </o:p></span></p>
        <p class="MsoNormal"><span style="mso-fareast-language:EN-US"
            lang="EN-US">“Paging with WFS 2.0<o:p></o:p></span></p>
        <p class="MsoNormal"><span style="mso-fareast-language:EN-US"
            lang="EN-US">The WFS driver will automatically detect if
            server supports paging, when requesting a WFS 2.0 server.
            The page size (number of features fetched in a single
            request) is limited to 100 by default when not declared by
            the server. It can be changed by setting the
            OGR_WFS_PAGE_SIZE configuration option, or by specifying
            COUNT as a query parameter in the URL of the connection
            string.<o:p></o:p></span></p>
        <p class="MsoNormal"><span style="mso-fareast-language:EN-US"
            lang="EN-US"><o:p> </o:p></span></p>
        <p class="MsoNormal"><span style="mso-fareast-language:EN-US"
            lang="EN-US">If only the N first features must be downloaded
            and paging through the whole layer is not desirable, the
            OGR_WFS_PAGING_ALLOWED configuration option should be set to
            OFF.”<o:p></o:p></span></p>
        <p class="MsoNormal"><span style="mso-fareast-language:EN-US"
            lang="EN-US"><o:p> </o:p></span></p>
        <p class="MsoNormal"><span style="mso-fareast-language:EN-US"
            lang="EN-US">So by default normally GDAL goes to paging mode
            that makes it possible to read the whole featuretype,
            possibly restricted with BBOX or other filters but it should
            be possible to disable paging with --config
            OGR_WFS_PAGING_ALLOWED OFF. I would try that.<o:p></o:p></span></p>
        <p class="MsoNormal"><span style="mso-fareast-language:EN-US"
            lang="EN-US"><o:p> </o:p></span></p>
        <p class="MsoNormal"><span style="mso-fareast-language:EN-US"
            lang="EN-US">-Jukka Rahkonen-<o:p></o:p></span></p>
        <p class="MsoNormal"><span style="mso-fareast-language:EN-US"
            lang="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>Lähettäjä:</b> gdal-dev
              <a class="moz-txt-link-rfc2396E" href="mailto:gdal-dev-bounces@lists.osgeo.org"><gdal-dev-bounces@lists.osgeo.org></a>
              <b>Puolesta </b>Hernán De Angelis<br>
              <b>Lähetetty:</b> maanantai 29. marraskuuta 2021 12.43<br>
              <b>Vastaanottaja:</b> <a class="moz-txt-link-abbreviated" href="mailto:gdal-dev@lists.osgeo.org">gdal-dev@lists.osgeo.org</a><br>
              <b>Aihe:</b> [gdal-dev] ogr2ogr and WFS 2<o:p></o:p></p>
          </div>
        </div>
        <p class="MsoNormal"><o:p> </o:p></p>
        <p class="MsoNormal" style="margin-bottom:12.0pt"><span
            style="font-size:10.0pt;font-family:"Courier New"">Dear
            all<br>
            <br>
            I seem to have problems understanding how ogr2ogr interacts
            with WFS and hope someone would be able to clarify.<br>
            <br>
            I have this WFS:<br>
            <br>
            <a
href="https://stationsregister.miljodatasamverkan.se/geoserver/stationsregistret/wfs"
              moz-do-not-send="true" class="moz-txt-link-freetext">https://stationsregister.miljodatasamverkan.se/geoserver/stationsregistret/wfs</a>?<br>
            <br>
            The capabilities document states that it supports WFS 1.0.0,
            1.1.0 and 2.0.0.<br>
            <br>
            If I do:<br>
            <br>
            ogr2ogr -f GPKG test.gpkg "WFS:<a
href="https://stationsregister.miljodatasamverkan.se/geoserver/stationsregistret/wfs?SERVICE=WFS&VERSION=1.0.0&REQUEST=GetFeature&TYPENAME=stationsregistret:active_site&MAXFEATURES=100"
              moz-do-not-send="true">https://stationsregister.miljodatasamverkan.se/geoserver/stationsregistret/wfs?SERVICE=WFS&VERSION=1.0.0&REQUEST=GetFeature&TYPENAME=stationsregistret:active_site&MAXFEATURES=100</a>"<br>
            <br>
            I get a small and nice GPKG file very fast.<br>
            <br>
            But if I do:<br>
            <br>
            ogr2ogr -f GPKG test.gpkg "WFS:<a
href="https://stationsregister.miljodatasamverkan.se/geoserver/stationsregistret/wfs?SERVICE=WFS&VERSION=2.0.0&REQUEST=GetFeature&TYPENAMES=stationsregistret:active_site&COUNT=100"
              moz-do-not-send="true">https://stationsregister.miljodatasamverkan.se/geoserver/stationsregistret/wfs?SERVICE=WFS&VERSION=2.0.0&REQUEST=GetFeature&TYPENAMES=stationsregistret:active_site&COUNT=100</a>"<br>
            <br>
            It downloads the whole layer.<br>
            <br>
            This behaviour can be seriously impractical for services
            exposing a large number of features.<br>
            <br>
            <br>
            Pay attention that if I do:<br>
            <br>
            curl <a
href="https://stationsregister.miljodatasamverkan.se/geoserver/stationsregistret/wfs?SERVICE=WFS&VERSION=2.0.0&REQUEST=GetFeature&TYPENAMES=stationsregistret:active_site&COUNT=100"
              moz-do-not-send="true">
"https://stationsregister.miljodatasamverkan.se/geoserver/stationsregistret/wfs?SERVICE=WFS&VERSION=2.0.0&REQUEST=GetFeature&TYPENAMES=stationsregistret:active_site&COUNT=100"</a><br>
            <br>
            it retrieves a short document fast with just 100 features.
            The same of course if I invoke the service using WFS 1.0.0
            or 1.1.0.<br>
            <br>
            <br>
            What is going on here? Is it me that I misunderstood
            something about how ogr2ogr is supposed to interact with WFS
            services?<br>
            <br>
            Using GDAL 3.4.0, released 2021/11/04. But the same
            behaviour was observed in 3.3.2.<br>
            <br>
            <br>
            Thanks in advance for any clarification<br>
            <br>
            <br>
            Hernán<br>
            <br>
            <br>
          </span><o:p></o:p></p>
      </div>
    </blockquote>
    <br>
  </body>
</html>