I set <LayerLimit>1</LayerLimit> in service metadata in capabilities file to restrict the number of layers that the client is permitted to request in a single GetMap request. But when I add a new WMS layer in QGIS, still I can select multiple layers simultaneously and multiple layers are requested coma separated ("LAYERS=layer1,layer2,layer3"). Does layer limit work differently? What is the correct way to restrict multiple layers request?

WMS version

<WMS_Capabilities xmlns:xlink="http://www.w3.org/1999/xlink" version="1.3.0">
  • What software is providing the WMS service?
    – nmtoken
    Aug 15, 2017 at 8:27
  • @nmtoken, I wrote a simple application in Python, it serves GetCapabilities and GetMap requests. It's based on Tornado. Geoprocessing is performed by means of GDAL + vsicurl
    – dr_times
    Aug 15, 2017 at 8:44
  • @nmtoken, I'm not sure that the service matters here. I'd like to discourage the user to request multiple layers (at the client side)
    – dr_times
    Aug 15, 2017 at 8:51
  • It's the server that sets the layer rule and responds to GetMap requests. A client may not parse the layerlimit parameter in the capabilities response and give a standard GetMap request with multiple layers. Just in the same way as a client is not meant to ask for CRS not advertised in the service, but can do so... it is up to the server to say no I don't support that CRS so I'm going to give an error. So... If the server gives multiple layers on a GetMap request, even though it advertises that only one layer can be requested, then that is a server issue.
    – nmtoken
    Aug 15, 2017 at 11:16

1 Answer 1


For WMS 1.3.0 service implementations you can set a layer limit in the service metadata, how to do this varies on software.

For example in MapServer it is set in the MAP > WEB > METADATA section with "WMS_LAYERLIMIT" "8", and in the GetCapabilities response at location /WMS_Capabilities/Service/LayerLimit we have <LayerLimit>8</LayerLimit>.

If we look at the following GetMap requests (generated in QGIS) we can see the expected server behaviour to requests up to and beyond the layer limit.

Eight Layers requested (we get a map):


Nine layers requested (we get an error):


  xsi:schemaLocation="http://www.opengis.net/ogc http://schemas.opengis.net/wms/1.3.0/exceptions_1_3_0.xsd">
    msWMSLoadGetMapParams(): WMS server error. 
    Number of layers requested exceeds LayerLimit.

So you are correct when you note that QGIS doesn't honour the advertised layer limit, this is technically a bug, because a client shouldn't request something that isn't advertised.

But your server is also at fault because it shouldn't provide something that the service provider (you) hasn't configured (even if the software is able to do so). People set limits on services for a reason...

  • thank you. Should I report an issue?
    – dr_times
    Aug 16, 2017 at 16:48
  • It's always worth reporting an issue
    – nmtoken
    Aug 16, 2017 at 17:47

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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