Basemap layers

Basemaps exposes a 'base layers' property, which contains all of the layers in the basemap. The BaseLayers property can be accessed through the basemap property on maps and scenes. Note that using a basemap for all your maps is recommended, when a suitable one is available. Some examples of basemaps that can be created using static factory methods are:

Adding a layer to muliple maps or scenes

A layer can be added only once to a single map or scene. If you add a layer already in one map or scene to another map or scene then an exception will be thrown with the message: Object is already owned. To use the same layer in more than one map or scene you have a few options:

If you need the layer to be in two map or scene objects (or one of each!) you can add a copy of the layer to your second map or scene.

Note:

The copy/clone method takes deep copy of the specific layer type, rather than the Layer base class. Any changes made to the original layer will not be reflected in the copied version of the layer.

Create a new layer from the original source data. This is not the recommended approach because it requires accessing the underlying data source twice. For example, in the case of layers made from an online source, it would mean accessing the associated service twice.

If the layer is no longer required in the first map or scene, remove the layer from the first map or scene and add it to the second map or scene.