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
nmtoken
13.6k5 gold badges39 silver badges91 bronze badges
asked Dec 17, 2017 at 14:00
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
user30184
71.5k4 gold badges76 silver badges130 bronze badges
answered Dec 17, 2017 at 15:35
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. Commented Dec 17, 2017 at 17:23
  • The answer is correct, I hope that the one who downvoted will take it back. Commented Dec 17, 2017 at 20:56

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

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

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.