RenameLayer()

Summary

Changes the name of a layer.

Syntax

new_name = RenameLayer(string map_layer, string new_layer_name, array options)

Argument Contents
map_layer The fully specified layer name
new_layer_name The requested new layer name
Option Type Contents
Permanent Boolean If "True" permanently changes the layer name as stored in the geographic file

Returns

A string indicating the name actually assigned to the layer.

Notes

  • If the new_layer_name already belongs to a layer in the system, the name actually assigned will have an ordinal suffix such as "US Counties:1."

  • The limit is 31 for the length of the layer name in the session. If the "Permanent" option is chosen, the internal name limit is 20 but the name of the layer in the map can still be 31.

  • new_layer_name is automatically truncated to these limits, without an error.

Example

new_name = RenameLayer("U.S. States", "The 50 States Plus DC", )
new_name = RenameLayer("foo", "aaaaaaaaaabbbbbbbbbbccccccccccdddddddddd",)
// Renames layer in session to "aaaaaaaaaabbbbbbbbbbccccccccccd"
// Internal name will remain "foo"
new_name = RenameLayer("foo", "aaaaaaaaaabbbbbbbbbbccccccccccdddddddddd", {{"Permanent", "True"}})
// Renames layer in session to "aaaaaaaaaabbbbbbbbbbccccccccccd"
// Internal name will become "aaaaaaaaaabbbbbbbbbb"

Error Codes

Error Type Meaning
Error New_layer_name is null or an option value is invalid.
NotFound The specified layer does not exist

See Also

Function Summary
SetMapTitle() Sets the title of a map
RenameSet() Changes the name of a selection set