Working with layers
You have already done some work with layers by fixing the broken links. In this section, you will learn more about the layer object and its classes and functions, along with how it interacts with the map object. First, you will learn how to add, move, and remove layers from a map.
Adding, moving, and removing layers
You can add layers to a map using different methods on the map object:
addBasemap(basemap_name)
adds a basemap layer to a map.addDataFromPath(data_path)
adds a layer to a map from the local path or a URL.addLayer(add_layer, {position})
adds a layer from another map, or a layer file (.lyrx
) to a map at a defined position of'AUTO_ARRANGE'
(default),'TOP'
, or'BOTTOM'
.insertLayer(reference_layer, insert_layer, {insert_position})
adds a layer either'BEFORE'
(default) or'AFTER'
a reference layer that is in the map.
The addLayer
and insertLayer
...