SetLayerVisibility()

Summary

Set whether a layer is visible (displayed) in a map.

Syntax

SetLayerVisibility(string map_bar_layer, string visibility)

Argument Contents
map_bar_layer The name of the map and layer
visibility "True" if the specified layer is shown, otherwise "False"

Notes

  • If map_bar_layer is null, SetLayerVisibility() affects the current layer in the current map.

  • If map_bar_layer is a layer name, SetLayerVisibility() affects the current map.

  • Even if a layer is visible, the autoscale settings for the layer may cause it not to be displayed at the current map 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

// Make States visible but Counties hidden
SetLayerVisibility("States", "True")
SetLayerVisibility("Counties", "False")
// Make States visible in one map, but not the other
SetLayerVisibility("Map #1|States", "True")
SetLayerVisibility("Map #2|States", "False")

Error Codes

Error Type Meaning
NotFound The specified layer does not exist or is not in the specified 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
GetLayerVisibility() Determine whether a layer is visible (displayed) in a map
SetLayerScale() Sets the range of scales at which a layer displays (autoscale)
SetLayerScaleFlag() Sets the autoscale flag for a layer
SetDisplayStatus() Changes how features in a selection set are displayed on a map