That was it! Thanks!
Met vriendelijke groet,
Meine Toonen
B3Partners BV
Tel: 030 214 2083
On 16-02-17 18:48, Ian Turton wrote:
I take that back - I was still using an old wfs rather than wfs-ng!
So with one change to the previous code change -
query.setMaxFeatures(10+i);
and it works fine - the trick seems to be that MaxFeatures is taken to
be an absolute count rather than a number of features to return.
As to whether that's a bug or a documentation bug I'll need to check
my WFS spec tomorrow.
Ian
PS all my tests so far have been with WFS 1.0.0
On 16 February 2017 at 17:32, Ian Turton <ijtur...@gmail.com
<mailto:ijtur...@gmail.com>> wrote:
That does look like a bug!
I tried the following with a local geoserver
SimpleFeatureSource source = datastore.getFeatureSource(name);
for (int i = 0; i < 2; i++) {
int count = 0;
Query query = new Query();
query.setSortBy(new SortBy[] { ff.sort("STATE_NAME",
SortOrder.DESCENDING) });
query.setStartIndex(i);
query.setMaxFeatures(10);
try (SimpleFeatureIterator itr
= source.getFeatures(query).features()) {
while (itr.hasNext()) {
SimpleFeature feature = itr.next();
System.out.println(i+" "+(count++) + " " +
feature.getAttribute("STATE_NAME"));
}
}
}
And get
0 0 Illinois
0 1 District of Columbia
0 2 Delaware
0 3 West Virginia
0 4 Maryland
0 5 Colorado
0 6 Kentucky
0 7 Kansas
0 8 Virginia
0 9 Missouri
1 0 Illinois
1 1 District of Columbia
1 2 Delaware
1 3 West Virginia
1 4 Maryland
1 5 Colorado
1 6 Kentucky
1 7 Kansas
1 8 Virginia
1 9 Missouri
which is neither offset or sorted!
I'll take a look tomorrow and see if anything pops out.
Ian
On 16 February 2017 at 15:56, Meine Toonen
<meinetoo...@b3partners.nl <mailto:meinetoo...@b3partners.nl>> wrote:
Dear all,
I try to retrieve features using the WFS-NG module. We do this
in batches of 10 to show it in a table-like grid, and we
support paging. With the old module this worked: we
implemented the "paging" ourselves when the capabilities
showed it didn't support an offset. With the new module, I
encounter some weird behavior: according to the
querycapabilities it supports offset (link
<https://github.com/geotools/geotools/blob/75b7dedf87aec993a92e924ccf1d9ac4053a9434/modules/library/data/src/main/java/org/geotools/data/store/ContentFeatureSource.java#L1213-L1220>).
The first 10 (ranging from index 0 - 9) work fine, but the
second 10 (ranging from index 10 - 19) yields no result.
The comments say that offset is supported through sorting (in
the capabilities the sorting is supported through a
SortedFeatureReader). But upon inspecting the retrieval of
features through the reader, it doesn't use the
SortedFeatureReader (the call to canSort() is true: link
<https://github.com/geotools/geotools/blob/75b7dedf87aec993a92e924ccf1d9ac4053a9434/modules/library/data/src/main/java/org/geotools/data/store/ContentFeatureSource.java#L666-L671>).
The query to the featuresource is:
feature type:
http://flamingo4.b3p.nl/geoserver/Test_omgeving:Test_omgeving:cbs_gemeente_2014
<http://flamingo4.b3p.nl/geoserver/Test_omgeving:Test_omgeving:cbs_gemeente_2014>
filter: [Filter.INCLUDE]
[properties: GM_CODE, GM_NAAM]
[sort by: GM_CODE ASCENDING]
MaxFeatures is 10
StartIndex is 10
Any idea what I'm doing wrong? Or did I encounter a bug (if
so, I'm happy to supply a patch if someone can point me in the
right direction)?
--
Met vriendelijke groet,
Meine Toonen
B3Partners BV
Tel: 030 214 2083
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, SlashDot.org! http://sdm.link/slashdot
_______________________________________________
GeoTools-GT2-Users mailing list
GeoTools-GT2-Users@lists.sourceforge.net
<mailto:GeoTools-GT2-Users@lists.sourceforge.net>
https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users
<https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users>
--
Ian Turton
--
Ian Turton
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, SlashDot.org! http://sdm.link/slashdot
_______________________________________________
GeoTools-GT2-Users mailing list
GeoTools-GT2-Users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users