-
-
Notifications
You must be signed in to change notification settings - Fork 2.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
WFS: Don't issue STARTINDEX if feature count is small #8146
WFS: Don't issue STARTINDEX if feature count is small #8146
Conversation
This adds the `OGR_WFS_PAGING_ALLOWED=CHECK_WITH_HITS` config option value, which causes OGR to issue a GetFeatureCount() request before deciding whether to paginate WFS layers. It doesn't work at present because it can easily cause infinite recursion: `MakeGetFeatureURL -> GetFeatureCount -> MakeGetFeatureURL` Builds on PR OSGeo#8146. Not sure this will proceed though.
Backports OSGeo#8146 Datasources with no primary key cannot be naturally ordered by the server, and so using the STARTINDEX argument causes a 400 error with the response: > Cannot do natural order without a primary key, please add it or > specify a manual sort over existing attributes This change avoids issuing STARTINDEX if: * the feature count is known by the time the first GetFeature request is issued * the feature count is less than the page size. In other words, this change allows us to use small datasets that have no primary key, while still allowing paging in larger datasets (as long as they have a primary key)
For tests, the best is to simulate a fake server by providing GetCapabilities, DescribeFeatureCount, GetFeature responses in temporary files like done in most of the tests of ogr_wfs.py. |
Backports OSGeo#8146 Datasources with no primary key cannot be naturally ordered by the server, and so using the STARTINDEX argument causes a 400 error with the response: > Cannot do natural order without a primary key, please add it or > specify a manual sort over existing attributes This change avoids issuing STARTINDEX if: * the feature count is known by the time the first GetFeature request is issued * the feature count is less than the page size. In other words, this change allows us to use small datasets that have no primary key, while still allowing paging in larger datasets (as long as they have a primary key)
Datasources with no primary key cannot be naturally ordered by the server, and so using the STARTINDEX argument causes a 400 error with the response: > Cannot do natural order without a primary key, please add it or > specify a manual sort over existing attributes This change avoids issuing STARTINDEX if: * the feature count is known by the time the first GetFeature request is issued * the feature count is less than the page size. In other words, this change allows us to use small datasets that have no primary key, while still allowing paging in larger datasets (as long as they have a primary key)
6575ecb
to
aeb4a11
Compare
I have added a test that exercises the new behaviour. |
The CI failures seem to be unrelated to the change I made here. Is there a known issue with CI? |
for the Mac one, now, yes :-) Due to a version upgrade of a dependency in homebrew |
Datasources with no primary key cannot be naturally ordered by the server, and so using the STARTINDEX argument causes a 400 error with the response: > Cannot do natural order without a primary key, please add it or > specify a manual sort over existing attributes This change avoids issuing STARTINDEX if: * the feature count is known by the time the first GetFeature request is issued * the feature count is less than the page size. In other words, this change allows us to use small datasets that have no primary key, while still allowing paging in larger datasets (as long as they have a primary key)
What does this PR do?
WFS datasources with no primary key cannot be naturally ordered by the server, and so using the STARTINDEX argument causes a 400 error with the response:
An example is here: https://geo.irceline.be/wfs?request=GetFeature&version=2.0.0&service=WFS&TYPENAMES=bc_24hmean&COUNT=1000000&STARTINDEX=0
This change avoids issuing
STARTINDEX
if:In other words, this change allows us to use small datasets that have no primary key, while still allowing paging in larger datasets (as long as they have a primary key)
What's not included
OGR_WFS_PAGING_ALLOWED
(COUNT_WITH_HITS
) in addition to the existing boolean values. I attempted to implement that but quickly came up against infinite recursion, since this makesMakeGetFeatureURL
callGetFeatureCount
which in turn eventually callsMakeGetFeatureURL
. I decided to skip that complication for this PR, which is still useful in most circumstances without it. The WIP change is here if you want to see it.Tests.I've now included a testWhat are related issues/pull requests?
As discussed in gdal-dev a month ago
Tasklist
Environment
Provide environment details, if relevant: