SetLayer()

Summary

Sets the current layer (and the current view).

Syntax

SetLayer(string layer_name)

Argument Contents
layer_name The name of the layer

Example

old_layer = GetLayer()
SetLayer("U.S. States")
// Do some stuff on the States layer...
SetLayer(old_layer)

Notes

  • SetLayer() also sets the current view to match the current layer.

  • If there are several mappable views linked to the current layer, the current view is chosen arbitrarily from among them.

  • Each map has its own current layer. There are times when no current layer has been set. In that case, GetLayer() returns null.

Error Codes

Error Type Meaning
Error Missing or syntactically invalid layer name
NotFound The layer does not exist

See Also

Function Summary
GetLayer() Gets the name of the current layer, if any
GetLayerNames() Gets a list of all layers in the system
SetView() Sets the current view (and the current layer)