[Geoserver-users] numberOfFeatures and maxfeatures

Hi list,

I am doing a WFS 1.1 request with a maxfeatures of 100. The real query
though yields more than 100 records, but I am only asking for the first
100.

But in the response XML the numberOfFeatures attribute is set to 100 by
Geosever. Is there a way to have this return the real number of features
returned by the WFS query instead of the maxfeatures limit?

TIA.

Best regards,
Bart

bartvde@anonymised.com ha scritto:

Hi list,

I am doing a WFS 1.1 request with a maxfeatures of 100. The real query
though yields more than 100 records, but I am only asking for the first
100.

But in the response XML the numberOfFeatures attribute is set to 100 by
Geosever. Is there a way to have this return the real number of features
returned by the WFS query instead of the maxfeatures limit?

The spec says:

"The optional numberOfFeatures attribute is used to indicate the number of features that
are in the response document. The count should only include feature type instances of
the feature type names specified in the typeName attribute of the <Query> element (i.e.
GetFeature/Query/@typeName) used to generate the response."

So the behaviour is correct, the number refers to the returned document
contents.

You can try out resultType=hits without passing maxFeatures in the
request thought, that should do it.

Cheers
Andrea

--
Andrea Aime
OpenGeo - http://opengeo.org
Expert service straight from the developers.

Hi Andrea,

thanks, so Geoserver is correct and we need to adapt Mapserver WFS :slight_smile:

But from a user point of view I don't like the spec in this regard.

Best regards,
Bart

bartvde@anonymised.com ha scritto:

Hi list,

I am doing a WFS 1.1 request with a maxfeatures of 100. The real query
though yields more than 100 records, but I am only asking for the first
100.

But in the response XML the numberOfFeatures attribute is set to 100 by
Geosever. Is there a way to have this return the real number of features
returned by the WFS query instead of the maxfeatures limit?

The spec says:

"The optional numberOfFeatures attribute is used to indicate the number
of features that
are in the response document. The count should only include feature type
instances of
the feature type names specified in the typeName attribute of the
<Query> element (i.e.
GetFeature/Query/@typeName) used to generate the response."

So the behaviour is correct, the number refers to the returned document
contents.

You can try out resultType=hits without passing maxFeatures in the
request thought, that should do it.

Cheers
Andrea

--
Andrea Aime
OpenGeo - http://opengeo.org
Expert service straight from the developers.