GetLayers()

Summary

Gets information on layers in the system and the current layer.

Changes

In Version 2018 added the optional array of types.

Syntax

layer_array = GetLayers(opt array types)

Argument Contents
types An optional array of strings with one or more layer types

Returns

An array of three elements:

Element Type Contents
1 Array An array of the names of layers in the system (strings)
2 Integer The index of the current layer in the list of names
3 String The name of the current layer

Notes

  • The array of types is an optional argument.

  • The array of types, if provided, restricts the layer types. For a description of the types, see IsLayer.

  • If no layers are present, the return value is null. If there is no current layer, the second array element is -1 and the third is null.

Example

lyr_info = GetLayers()
if lyr_info[3] = null then SetLayer(lyr_info[1][1])
lyrs = GetLayers({"Point"})
ShowArray(lyrs[1])

See Also

Function Summary
CopyLayerSettings() Copies the settings for a layer from one map to another
GetLayerNames() Gets a list of all layers in the system
GetLayer() Gets the name of the current layer, if any
GetMapCurrentLayer() Gets the name of the current layer in a map