Using Scale Dependent Rendering

Parent Previous Next

Using Scale Dependant Rendering

In most cases you will need to specify that MapServer should change how the layer is drawn according to the changes of the scale. For example when drawing an annotation layer at large scales the labels would cover the entire map and hide the features of the other layers. MapServer provides the following 2 options to achieve scale dependent maps. These options can be used in parallel when setting up the map configurations.

Specify the visibility of the layers to depend on the scale

In this case we can specify the scale range or the zoom range at which the layers should be visible. These parameters can be set in the General tab of the Layer Property Editor. By checking the Display Within Range checkbox you can select either the Scale range or the Zoom range option. In the Scale range mode the closest and the farthest scale can be specified as 2 separate parameters. When using the Zoom range option the minimum and the maximum of the zoom levels (ie. the width of the map in map units) should be specified. In both cases by omitting minimum or the maximum values the layer is drawn when the scale and the zoom level suits to the condition specified by the other parameter.

The scale range can also be specified at class level by setting the closest and farthest scale in the Display tab of the Class Property Editor. This allows you to use different styles for the same layer (or a subset of the features in the layer) depending on the actual scale. For example the railway could be drawn as thin solid lines when the map extent is large and thick dashed lines when the map is zoomed in. 

Both the Layer Property Editor and the Class Property Editor provides the button to set the current scale of the map as the minimum or maximum scale.

Specify the size of the symbols and labels drawn with the layer to depend on the scale

It may be reasonable to increase the visibility of the layers by setting up scale dependent symbol and label sizes. In this case the size of the symbols and labels are increased and decreased depending on the current scale of the map. The scale dependent sizes can be specified by the Symbol Scale parameter in the Label & Style tab of the Layer Property Editor. In this parameter you must specify a scale at which the labels and the symbols should be drawn at their default sizes. The default symbol size is specified with the Symbol size parameter of the Style Property Editor and the default label size is specified with the Size parameter of the Label Property Editor.