Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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.

code:{ "zoomend": function (e) {
        if (this.getZoom() > 7) {
        else {
share|improve this question
If taking the approach of hiding the layer then you can use the numZoomLevels or minScale/maxScale layer properties… – geographika Oct 26 '11 at 13:54
up vote 5 down vote accepted

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});
share|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...

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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