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.

Best

Hernán


Den 2021-11-30 kl. 08:59, skrev Rahkonen Jukka (MML):

Hi,

There is something about WFS 2 and paging in https://gdal.org/drivers/vector/wfs.html

“Paging with WFS 2.0

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.

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.”

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.

-Jukka Rahkonen-

*Lähettäjä:* gdal-dev <gdal-dev-boun...@lists.osgeo.org> *Puolesta *Hernán De Angelis
*Lähetetty:* maanantai 29. marraskuuta 2021 12.43
*Vastaanottaja:* gdal-dev@lists.osgeo.org
*Aihe:* [gdal-dev] ogr2ogr and WFS 2

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 <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 <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"; <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@lists.osgeo.org
https://lists.osgeo.org/mailman/listinfo/gdal-dev

Reply via email to