Add a layer

There are two common roles for layers:

  • Basemap layers - provide context (a background) for your data
  • Operational layers - the map data actively in use

For example, a map of a utility network might show pipes in an operational layer and a street map background (basemap) to make it clear which houses those pipes serve.

To learn more about layer concepts, see Layers and tables. To learn about supported layer types and the details for each, see Layer types described.

If you want to quickly visualize data that's available to your app, but don't want to store it in an ArcGIS portal or a layer, consider using graphics.

Operational layers

Maps and scenes expose an operational layers property, which is a collection of layers. You can add and remove layers from the map's operational layers.

ArcGISMap map = new ArcGISMap();
map.getOperationalLayers().add(someLayer);
map.getOperationalLayers().remove(someLayer);

Basemap layers

Basemaps exposes a 'base layers' property, which contains all of the layers in the basemap. The getBaseLayers method can be accessed through the basemap 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:

  • World imagery
  • World streets
  • National geographic
  • World navigation (vector)
  • World streets (vector)

// Use the navigation basemap constructor
ArcGISMap map = new ArcGISMap(Basemap.createNavigationVector());
// or
map.setBasemap(Basemap.createNavigationVector());
// or
map.getBasemap().getBaseLayers().add(someBasemapLayer);