2

So I made this mapfile and I tried to load multiple layers with status set to on but that doesn't work. The layers with "STATUS DEFAULT" load but the other two won't when I change the URL.

#### places LAYER
  LAYER   NAME  "places"
          TYPE           polygon
          DATA           "places"
          STATUS         DEFAULT
            CLASS
                  STYLE
                          COLOR           "#b2b266"
                          OUTLINECOLOR    "#331a00"
                  END
          END
  END
  #### water LAYER
  LAYER  NAME "water"
         TYPE         polygon
         DATA         "water"
         STATUS       ON
         CLASS
                STYLE
                        COLOR               "#1a8cff"
                        OUTLINECOLOR        "#00264d"
                END
        END
  END
  #### railroads LAYER
  LAYER  NAME "railways"
          TYPE             LINE
          DATA            "railways"
          STATUS        ON
          CLASS
                  STYLE
                          COLOR              "#ff6600"
                          SIZE                    3
                          SYMBOL              "line7"
                  END
          END
  END

If I set "LAYERS=water" or "LAYERS=railways" the layers will load but "LAYERS=water,railways" won't with the URL:

http://localhost/cgi-bin/mapserv.exe?map=/ms4w/apps/MyProject/project.map&layers=water,railways&mode=map
0

1 Answer 1

2

When you use mode=map you have to separate layer names by space not comma. In your case:

http://localhost/cgi-bin/mapserv.exe?map=/ms4w/apps/MyProject/project.map&layers=water railways&mode=map

Or you can use more layer=name parameters in the query string:

http://localhost/cgi-bin/mapserv.exe?map=/ms4w/apps/MyProject/project.map&layer=water&layer=railways&mode=map
2
  • 1
    The question is about CGI MapServer not WMS and it works for me (Ubuntu 16.04 and MapServer 7.0.7). Quote from MapServer docs: LAYERS [name name ...] The names of the layers to be turned on. Layer names must be separated by spaces.
    – Zoltan
    Dec 17, 2017 at 17:23
  • The answer is correct, I hope that the one who downvoted will take it back.
    – user30184
    Dec 17, 2017 at 20:56

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.