Maps (2D)

and provide interactive displays of geographic data that enable you to visualize and explore patterns, answer questions, and share insight. They can be opened, edited, and shared across the ArcGIS system and beyond. Maps are designed for interaction in two dimensions (2D) and scenes for interaction in three dimensions (3D). See Scenes (3D) in this guide for more information about working with scenes.

You can use a map to:

  • Display a such as streets or satellite imagery.
  • Access and display based on files or services, including data you have authored.
  • Provide context for temporary points, lines, polygons, or text displayed as .
  • Inspect data layers and display information from .
  • Measure distance and explore spatial relationships between .
  • Save a collection of layers as a to be shared across ArcGIS.

How a map works

A works together with a to display geographic content in two dimensions. A map contains a collection of including multiple from online or local sources, and a that gives geographic context. A map can also contain datasets that enable searches for addresses or place names, networks for solving , utility networks for tracing the flow of services such as water and electricity, and non-spatial tables. Maps can be created, displayed, edited, and saved using ArcGIS Runtime. Because the format is based on the ArcGIS web map standard, these maps can be shared uniformly across the ArcGIS system.

For workflows (when you don't have network connectivity), you can open a map stored in a mobile map package. Mobile map packages can be created using ArcGIS Pro, ArcGIS Enterprise, or ArcGIS Online. See Offline maps, scenes, and data for more information about implementing offline workflows with ArcGIS Runtime.

Map

A map contains a collection of displayed in the order in which they were added, with the most recently added layer being displayed above existing layers. You can use the map to change the display order of layers as well as to control which layers are visible, and expose this functionality with user interface controls such as lists, check boxes, or switches. A map also contains a collection of bookmarks, which, similar to a web browser bookmark, allow you to quickly navigate to a predefined area of the map.

You can open an existing map or create one entirely with code. To create a map, you typically first add a and then one or more .

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
ArcGISRuntimeEnvironment::setApiKey("YOUR_ACCESS_TOKEN");
Map* map = new Map(BasemapStyle::ArcGISNavigation, this);

You can also open a map stored in a (such as ArcGIS Online) using its URL.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
  const QUrl portal_url("https://www.arcgis.com/home/item.html?id=41281c51f9de45edaf1c8ed44bb10e30");
  m_map = new Map(portal_url, this);

Layer

Each in a map references geographic data, either from an online service or from a local dataset. There are different types of of layers that can be added to a map, each designed to display a particular type of data. Some layers display images, such as satellite imagery or aerial photography, while others are composed of a collection of to represent real-world entities using point, line, or polygon . In addition to geometry, features have that provide details about the entity it represents.

The Layer class is the base class for all types of layers used in ArcGIS Runtime. The type of layer you create depends on the type of data you want to display. For example, to display feature data you can create a FeatureLayer that references an online service (such as a ) or a supported local dataset.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
Map_data_layers_example::Map_data_layers_example(QObject* parent /* = nullptr */):
  QObject(parent),
  m_map(new Map(BasemapStyle::ArcGISTopographic, this))
{
  const QString accessToken = QStringLiteral("YOUR_ACCESS_TOKEN");
  ArcGISRuntimeEnvironment::setApiKey(accessToken);

  FeatureLayer* trailheadsLayer = new FeatureLayer(
      new ServiceFeatureTable(QUrl("https://services3.arcgis.com/GVgbJbqm8hXASVYi/arcgis/rest/services/Trailheads_Styled/FeatureServer/0"), this),
      this
  );
  FeatureLayer* trailsLayer = new FeatureLayer(
      new ServiceFeatureTable(QUrl("https://services3.arcgis.com/GVgbJbqm8hXASVYi/arcgis/rest/services/Trails_Styled/FeatureServer/0"), this),
      this
  );
  FeatureLayer* openSpacesLayer = new FeatureLayer(
      new ServiceFeatureTable(QUrl("https://services3.arcgis.com/GVgbJbqm8hXASVYi/arcgis/rest/services/Parks_and_Open_Space_Styled/FeatureServer/0"), this),
      this
  );

  m_map->operationalLayers()->append(trailheadsLayer);
  m_map->operationalLayers()->append(trailsLayer);
  m_map->operationalLayers()->append(openSpacesLayer);
}

MapView

A is a user-interface control that displays a single map in your app. It contains built-in functionality that allows the user to explore the map by zooming in and out, recentering the map display, or getting additional information about elements in the map. It also manages in one or more collections of . The graphics managed by the map view always display above all layers displayed in the map.

A control also allows you to:

  • Access data for data layers and graphics.
  • Display the current location as a point on the map.
  • Identify and select features at a specified location.
  • Export an image of the current display.
  • Rotate the map display.
  • Apply a time extent to filter the display of features.
  • Filter layer data using attribute and spatial criteria.

Display a by adding it to a MapView control. Changes you make to the map, such as adding, removing, or reordering layers, will immediately be reflected in the map view display. The Map::initialViewpoint() property will determine the area of the map shown when the map loads. You can also use MapView::setViewpointAnimated() and MapView::setViewpointRotation() to programmatically change the map area or orientation shown in the display.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
MapQuickView* mapView = new MapQuickView(map);
const Point center("-118.805", "34.027", spatialReference::wgs84());
mapView->setViewpoint(center, 72223.819286);

Examples

Create and display a map

You can display a basic map by creating one with a basemap layer, setting its initial extent, and adding it to a map view. To learn how to add additional data, see the Layers topic.

Steps

  1. Create a new Map , passing a BasemapStyle into the constructor.

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    Display_a_map::Display_a_map(QObject* parent /* = nullptr */):
        QObject(parent),
        m_map(new Map(BasemapStyle::ArcGISTopographic, this))
    
  2. Optionally, add one or more data layers to the map.

  3. Assign the map to a MapView to render the map.

  4. Set the map view Viewpoint to focus on a specified area of the map.

    Expand
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    void Display_a_map::setupMap()
    {
        const Point center(-118.805, 34.027, SpatialReference::wgs84());
        const Viewpoint viewpoint(center, 72223.819286);
        m_mapView->setViewpoint(viewpoint);
    }
    
    // Set the view. The setMapView function is created by Qt Creator when you
    // create the project and select the Qt Quick C++ app template.
    void Display_a_map::setMapView(MapQuickView* mapView)
    {
        if (!mapView || mapView == m_mapView)
        {
            return;
        }
    
        m_mapView = mapView;
        m_mapView->setMap(m_map);
        setupMap();
        emit mapViewChanged();
    }

You can also create and save a using or the map viewer and open it in your ArcGIS Runtime app.

Display a web map

You can open a saved as an in a , such as ArcGIS Online, using its or URL. A portal item can be secured to only allow access for authorized users, in which case you must provide credentials for access. To learn how to access secured content, see Security and authentication.

Steps

  1. Create a QString and set it to the for the item that stores the web map.

  2. Create a QUrl that appends the item ID to the ArcGIS Online base URL.

  3. Create a new map, passing the QUrl to the constructor.

  4. Set the map to a MapView to render the map.

Expand
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
  const QUrl portal_url("https://www.arcgis.com/home/item.html?id=41281c51f9de45edaf1c8ed44bb10e30");
  m_map = new Map(portal_url, this);

  m_mapView->setMap(m_map);
Expand

Display a mobile map

This example displays a from a . You can create your own mobile map (or scene) packages using ArcGIS Pro, or download existing packages from ArcGIS Online. The Mahou Riviera Trails mobile map package, for example, shows points of interest in Mahou Riviera.

Steps

  1. Create a MobileMapPackage using the path to a local .mmpk file.

  2. Use connect to signal when the package is done loading.

  3. Load the mobile map package.

  4. After the package loads, get the first map from the package using the MobileMapPackage::maps() property.

  5. Display the map in a MapView .

    Expand
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
        MobileMapPackage* m_mobileMapPackage = new MobileMapPackage(QDir::homePath() + "/ArcGIS/Runtime/Data/mmpk/MahouRivieraTrails.mmpk", this);
        connect(m_mobileMapPackage, &MobileMapPackage::doneLoading, this, [this](Error)
        {
            m_mapView->setMap(m_mobileMapPackage->maps().at(0));
        });
    	m_mobileMapPackage->load();
    
    Expand

Use API key access tokens

An , provided by an , can be used to authorize access to services and resources from your app, as well as to monitor access to those services. You can use a single for all requests made by your app, or assign individual for any classes that implements

Learn more about API key authentication

Tutorials

Samples

Change basemap

Create and save a map

Open mobile map package

Create geometries

Display device location with autopan modes

Manage operational layers

Services

Next steps

Your browser is no longer supported. Please upgrade your browser for the best experience. See our browser deprecation post for more details.

You can no longer sign into this site. Go to your ArcGIS portal or the ArcGIS Location Platform dashboard to perform management tasks.

Your ArcGIS portal

Create, manage, and access API keys and OAuth 2.0 developer credentials, hosted layers, and data services.

Your ArcGIS Location Platform dashboard

Manage billing, monitor service usage, and access additional resources.

Learn more about these changes in the What's new in Esri Developers June 2024 blog post.

Close