[Geoserver-devel] new feature: GeoServer hit counts > server max features -- GEOS-5627 + patch

Hi List,

I discussed getting GeoServer hit counts > max features limit a while back on the user's list and Andrea pointed me to the developers list to pursue it further.

I've taken some time out this weekend to develop a patch against master that adds this capability and lets users configure it through the GUI and also added a couple of unit tests.

The patch is attached to GEOS-5627

The patch works by setting max features to java.lang.Integer.MAX_VALUE (from Query.java in geotools) so this is the maximum we can count with this approach.

To setup the change to be configurable, I've added support for my new configuration flag "hitsIgnoreMaxFeatures" wherever I saw the "featureBounding" flag, so I've changed:

* config hibernate mappings
* legacyServiceReader (legacy... is this needed?)
* rest/WFSSettingsResource and wfsSettings.ftl
* WFS admin page in GUI
* GeoServerApplication.properties language file (needs translations for other languages files?)
* WFS GetFeature
* WFS Info
* WFSLoader
* ... And added a new unit test class GetFeatureHitsIgnoreMaxFeatures

How does this sound? It would be great to get this into GeoServer 2.4. I'm happy to do more work on this if its needed.

Thanks,
Geoff

On Sat, Feb 2, 2013 at 9:25 AM, Geoff Williams <geoff@anonymised.com> wrote:

Hi List,

I discussed getting GeoServer hit counts > max features limit a while
back on the user’s list and Andrea pointed me to the developers list to
pursue it further.

I’ve taken some time out this weekend to develop a patch against master
that adds this capability and lets users configure it through the GUI
and also added a couple of unit tests.

The patch is attached to GEOS-5627

The patch works by setting max features to java.lang.Integer.MAX_VALUE
(from Query.java in geotools) so this is the maximum we can count with
this approach.

To setup the change to be configurable, I’ve added support for my new
configuration flag “hitsIgnoreMaxFeatures” wherever I saw the
“featureBounding” flag, so I’ve changed:

  • config hibernate mappings
  • legacyServiceReader (legacy… is this needed?)
  • rest/WFSSettingsResource and wfsSettings.ftl
  • WFS admin page in GUI
  • GeoServerApplication.properties language file (needs translations for
    other languages files?)
  • WFS GetFeature
  • WFS Info
  • WFSLoader
  • … And added a new unit test class GetFeatureHitsIgnoreMaxFeatures

How does this sound? It would be great to get this into GeoServer 2.4.
I’m happy to do more work on this if its needed.

Hi there,
had a look at the patch, seems quite good to me.

One, note, where you say in the patch:


```
@@ -92,6 +93,8 @@ public class WFSInfoImpl extends ServiceInfoImpl implements WFSInfo {
         result = prime * result
                 + ((serviceLevel == null) ? 0 : serviceLevel.hashCode());
         result = prime * result + (encodeFeatureMember ? 83 : 87);
+        // CHECK are values just random numbers?
+        result = prime * result + (hitsIgnoreMaxFeatures ? 21 : 16);
```

Err… normally I’d choose prime numbers, but the line before has 83 and 87,
of which only 83 is prime. I guess choosing two primes is probably better, and then
remove the comment :slight_smile:

Let’s hear what the other developers think about this

Cheers
Andrea

==
Our support, Your Success! Visit http://opensdi.geo-solutions.it for more information.

Ing. Andrea Aime
@geowolf
Technical Lead

GeoSolutions S.A.S.
Via Poggio alle Viti 1187
55054 Massarosa (LU)
Italy
phone: +39 0584 962313
fax: +39 0584 1660272
mob: +39 339 8844549

http://www.geo-solutions.it
http://twitter.com/geosolutions_it


On 02/02/13 20:36, Andrea Aime wrote:

Err... normally I'd choose prime numbers, but the line before has 83 and 87,
of which only 83 is prime. I guess choosing two primes is probably
better, and then
remove the comment :slight_smile:

Let's hear what the other developers think about this

Cheers
Andrea

Done - patch v2 attached to JIRA

Thanks Andrea!