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

We have a Mapserver mapfile used in a web app with a lot of layers. We want to publish only some of them with WMS, keeping the others hidden to any WMS request.

It has to be the same mapfile and we need each layer has its NAME attribute specified

Is there any way to do this?

share|improve this question
up vote 2 down vote accepted

Have a look at this:

or better yet:

I don't think it's possible right now, maybe in the forthcoming 6.0 version, according to:

share|improve this answer
See the Mapserver RFC 67 for more now – ThomasG77 Feb 21 '11 at 11:29

Use MapProxy or GeoWebCache to proxy your service. You can specify which layers to include. If your layer is fairly static the caching can improve the performance of your service.

If your WMS is used internally, you can put the regular WMS on one port and the proxied WMS on another port. Or, you can use security in the Web server component to control access.

share|improve this answer

You could use the STATUS parameter in the LAYER sections of the mapfile.

There are three possible values:

  • default: always generates the layer
  • on: generates the layer only when requested
  • off: never generates the layer

I guess you could use the off value, but maybe you use the mapfile for other purposes. Also, I'm not sure of the behaviour when calling GetCapabilities.

share|improve this answer
It doesn't work. Whatever value you put as STATUS, the layer is returned in a GetCapabilities request. And the same for the rest WMS requests – Javier Mollá Jul 23 '10 at 7:39
Bad luck, then. – Pablo Rodriguez Jul 23 '10 at 8:13

If you're trying to have layers draw (like background or outline layers) but not allow the requesting client to control them, you might be able to publish the "locked" layers as a separate service, then add them to your "public" service as a raster layer.



You won't be able to directly query those layers from the outside, and it would be possible to turn them all on or off, but they would be visible.

share|improve this answer

An idea might be to configure a false extend for the layer.

Just use coordinates on the other side of the Earth. The layer will still appears in the layer list, requests will still be possible but if a user simply select it in a GIS software and choose "zoom to layer" he will not see anything and might think that this layer is simply empty or does not work.. A web app knowing the correct extend of the layer should still be able to access it normally.

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.