Here is the code example:
Query query = new Query("countries", CQL.toFilter("REGION = 3") );
int count = featureSource.getCount( query );
if( count == -1 ){
count = featureSource.getFeatures( query ).size();
}
Why the difference? The first one checks the header (or index) if such a thing exists. The second one checks the content.
Docs harmed in the making of this post:
- DataStore (GeoTools User Guide)
- FeatureSource (javadocs)
No comments:
Post a Comment