1

I'm using the following code to display my mapfile layers:

var wmsSource = new ol.source.ImageWMS({
            url: 'http://localhost/cgi-bin/mapserv.exe?MAP=/ms4w/apps/GEO/test.map',
            params: {'LAYERS': 'layer1,layer2...layerN'},
            serverType: 'mapserver',
            crossOrigin: 'anonymous'
});

Is there any simpler solution instead of typing all the layer names?

I mean something like this: params: {'LAYERS': all} ?

2

MapServer supports LAYERS=all as CGI parameter, but not in the WMS interface.

But you can use the name of the root layer, which is "MS" by default, and can be set with the wms_rootlayer_name metadata property.

| improve this answer | |
  • 1
    you can also use group layers – nmtoken Mar 2 at 15:26

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.