Does the a wms layer in openlayers have "maxfeatures" option?

I'm asking this because my wms layer contains allot of points ( > 100.000). When zoomed in I don't want the rest of the features (not sure if you call it features when using wms) to be rendered.

When I was using WFS, this was my code:

    wfs = new OpenLayers.Layer.Vector("WFS", {
        strategies: [new OpenLayers.Strategy.BBOX({
                        resFactor: 1,
        protocol: new OpenLayers.Protocol.WFS({
                        url:  "my url",
                        featureType: "my_featuretype",
                        featureNS: "my_feature ns",
                        version: "1.1.0"

How can I accomplish the same render functionality with a wms layer?


Solution: Hide the layer at a certain zoomlevel. This prevents a big amount of features to be loaded.


    map.events.on({ "zoomend": function (e) {
        if (this.getZoom() > 7) {
        else {

A WMS uses images generated on the server so any filtering also has to be done on the server. The WMS specification does not include a MAXFEATURES parameter, but many map servers do allow filtering.

Your tag implies you are using GeoServer so have a look at its WMS MaxFeatures option.

This is a vendor specific parameter, which can be added to your OpenLayers WMS configuration.

var wms = new OpenLayers.Layer.WMS("Test",
                                   {layers: "test", maxfeatures: 500});
| improve this answer | |
  • Thanks again haha. You've been a great help so far. I noticed that it only does render the features inside the view port, which is good! I set the visibility to false when a certain zoom level is reached. This worked, but I'll ad the maxfeatures to the layer aswel to be sure. – Boedy Oct 26 '11 at 11:35

in openlayers Cluster Strategy maybe solve your problem for big dataset..See OpenLayers Cluster Strategy .. in this method you dont need to limit yourself...

and the same handling big dataset problem in google you can read this...

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.