I visualize a shape-layer in the mapserver. Now I want to make some requests for only some classes of this layer. I want for example one request for only the water-classes and later for only the wood-classes. Can I realise this with the mapserver?

3 Answers
3

Here is another way that you can do it. This way involves using one layer with expressions in each class. It is a little more 'expensive' to do it this way because it involves logical expressions, but you may never notice the difference unless you hit really high-load situations.

Each class has a two-part expression. Both parts of the expression need to be true for the features to be drawn. The first part of the expression selects the features that should fall into that class based on an attribute in your shapefile. The second part of the expression evaluates the value of a variable passed in through the url. It doesn't matter what you name the variable in your url (don't use any reserved words like 'layer'), it just has to match the variable name in your expression.

Since this is the third valid way of accomplishing your goal, you really want to think about what your objectives are. If your data changes frequently, you may want to go with this option. If your data doesn't change as often, I would personally go with two layers. I might even split the shapefile into multiple shapefiles by land use type if that improved performance. (It might not, layer filters are pretty efficient). With Web mapping, the more you pre-optimize your data, the better.

If you really, really need them all in one layer, you can used Named Styles to achieve this. See here for more details. Peter's suggestion of multiple layers is in many ways a much simpler approach, however.