SetLayerScale()

Summary

Sets the range of scales at which a layer displays (autoscale).

Syntax

SetLayerScale(string layer_name, real min_scale, real max_scale)

Argument Contents
layer_name The name of the layer
min_scale The minimum scale at which the layer displays
max_scale The maximum scale at which the layer displays

Notes

  • SetLayerScale() applies autoscaling to the current map; the autoscale parameters for a layer can vary from map to map.

  • If the min_scale is null, the layer displays at any scale less than the max_scale. If the max_scale is null, the layer displays at any scale greater than the min_scale. If both are null, the layer displays at any scale.

  • Otherwise, the layer displays only when it is part of a map whose scale falls in the specified range. When the scale of the map is outside the scale of the layer, the layer is automatically hidden.

  • The min_scale and max_scale are the denominators in the scale ratio; that is, to set a layer to display between 1:1000 and 1:200,000, set min_scale to 1000 and max_scale to 200,000. Min_scale should always be less than max_scale.

  • Autoscaling is useful for layers that are too detailed to be useful when viewed at a small scale, or too coarse to be useful when viewed at a large scale.

  • SetLayerScaleFlag() turns autoscaling on or off for a layer without clearing the autoscale settings from the layer, and GetLayerScaleFlag() gets the autoscale flag for a layer. Make sure that the flag is "True" to have autoscaling active for a layer.

Example

// Set manhole cover points to display only between 1:1000 and 1:200,000
SetLayerScale("Manholes", 1000, 200000)
// Set zones to display at any scale
SetLayerScale("Zones", null, null)

Error Codes

Error Type Meaning
NotFound The specified layer does not exist or is not in the current map

See Also

Function Summary
GetLayerAutoscale() Determines whether a layer is hidden in the current map due to autoscaling
GetLayerScale() Gets the range of scales at which a layer displays (autoscale)
GetLayerScaleFlag() Gets the autoscale flag for a layer
GetSetScale() Gets the range of scales at which a selection set displays (autoscale)
GetScale() Gets the scale of a map
SetLayerScaleFlag() Sets the autoscale flag for a layer
SetLayerVisibility() Set whether a layer is visible (displayed) in a map
SetScale() Sets the scale of a map
SetSetScale() Sets the range of scales at which a selection set displays (autoscale)