[gdal-dev] ogr2ogr and WFS 2

Hernán De Angelis variablestarlight at gmail.com
Mon Nov 29 04:25:22 PST 2021


Thank you for the clarification, Even. Now I understand how this works. 
I also think the pull request will help to make ogr2ogr behave more as 
is intuitively expected.

Have a nice day!

Hernán


Den 2021-11-29 kl. 13:11, skrev Even Rouault:
>
> Hernán,
>
> The URL you specify in the WFS: connection string isn't in general the 
> one of a GetFeature request, but only the endpoint of the service. 
> When you specify a GetFeature request, some heuristics trigger, but in 
> WFS 2, the COUNT parameter is interpreted as the page size, but as 
> this server supports paging, it is actually overridden by the page 
> size returned by the server (this part is a bug, addressed per 
> https://github.com/OSGeo/gdal/pull/4914), and anyway whatever the page 
> size used, it scrolls by default through the results.
>
> If you add  --config OGR_WFS_PAGING_ALLOWED NO you'll get the behavior 
> you expect. The above mentioned pull request also clarifies this 
> hopefully.
>
> Even
>
> Le 29/11/2021 à 11:43, Hernán De Angelis a écrit :
>> Dear all
>>
>> I seem to have problems understanding how ogr2ogr interacts with WFS 
>> and hope someone would be able to clarify.
>>
>> I have this WFS:
>>
>> https://stationsregister.miljodatasamverkan.se/geoserver/stationsregistret/wfs?
>>
>> The capabilities document states that it supports WFS 1.0.0, 1.1.0 
>> and 2.0.0.
>>
>> If I do:
>>
>> ogr2ogr -f GPKG test.gpkg 
>> "WFS:https://stationsregister.miljodatasamverkan.se/geoserver/stationsregistret/wfs?SERVICE=WFS&VERSION=1.0.0&REQUEST=GetFeature&TYPENAME=stationsregistret:active_site&MAXFEATURES=100"
>>
>> I get a small and nice GPKG file very fast.
>>
>> But if I do:
>>
>> ogr2ogr -f GPKG test.gpkg 
>> "WFS:https://stationsregister.miljodatasamverkan.se/geoserver/stationsregistret/wfs?SERVICE=WFS&VERSION=2.0.0&REQUEST=GetFeature&TYPENAMES=stationsregistret:active_site&COUNT=100"
>>
>> It downloads the whole layer.
>>
>> This behaviour can be seriously impractical for services exposing a 
>> large number of features.
>>
>>
>> Pay attention that if I do:
>>
>> curl 
>> "https://stationsregister.miljodatasamverkan.se/geoserver/stationsregistret/wfs?SERVICE=WFS&VERSION=2.0.0&REQUEST=GetFeature&TYPENAMES=stationsregistret:active_site&COUNT=100"
>>
>> 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.
>>
>>
>> What is going on here? Is it me that I misunderstood something about 
>> how ogr2ogr is supposed to interact with WFS services?
>>
>> Using GDAL 3.4.0, released 2021/11/04. But the same behaviour was 
>> observed in 3.3.2.
>>
>>
>> Thanks in advance for any clarification
>>
>>
>> Hernán
>>
>>
>>
>>
>> _______________________________________________
>> gdal-dev mailing list
>> gdal-dev at lists.osgeo.org
>> https://lists.osgeo.org/mailman/listinfo/gdal-dev
> -- 
> http://www.spatialys.com
> My software is free, but my time generally not.
>
> _______________________________________________
> gdal-dev mailing list
> gdal-dev at lists.osgeo.org
> https://lists.osgeo.org/mailman/listinfo/gdal-dev
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/gdal-dev/attachments/20211129/c07e35cf/attachment-0001.html>


More information about the gdal-dev mailing list