Migrate to ArcGIS Platform location services

Follow these steps to migrate your existing ArcGIS Runtime app to use ArcGIS Platform location services.

This information is intended for developers who have an existing app built with one of the ArcGIS Runtime APIs and would like to update it to use ArcGIS Platform location services. To use ArcGIS Platform location services, your app must use ArcGIS Runtime version 100.10 or later. Use the current version of ArcGIS Runtime to ensure that you have access to the latest ArcGIS Platform capabilities.

If your app was built with ArcGIS Runtime version 10.x, refer to the Migrate to 100.x from 10.2.x topic for help migrating to 100.x.

Authentication

To use any of the ArcGIS Platform location services, your app must provide authentication with an access token. Access tokens define the scope and permissions available to your application.

There are three kinds of access tokens:

  • API key: a permanent token that grants your application access to ready-to-use services.
  • ArcGIS identity: a temporary token generated with OAuth 2.0 that gives your application access to the private content and ready-to-use services available to an existing ArcGIS user's account.
  • Application credentials: a temporary token generated with OAuth 2.0 that authorizes access to ready-to-use services.

Learn more about getting and using an access token in Security and authentication and the Display a map tutorial.

Global API key

You can provide your API key to ArcGIS Runtime when your app starts by setting it on ArcGISRuntimeEnvironment.

                           
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

  const QString apiKey = QStringLiteral("YOUR_API_KEY");

  if (apiKey.isEmpty())
  {
      qWarning() << "Use of Esri location services, including basemaps, requires "
                    "you to authenticate with an ArcGIS identity or set the API Key property.";
  }
  else
  {

      ArcGISRuntimeEnvironment::setApiKey(apiKey);

  }



// Create a new 'topographic' basemap.
Basemap* basemap = new Basemap(BasemapStyle::ArcGISTopographic, this);

// Optionally, set a specific API key for the basemap.
// (Not required if a global API key is set)

basemap->setApiKey("YOUR_API_KEY");

// Create a map that uses the basemap.
Map* map = new Map(basemap, this);

You can provide your API key to ArcGIS Runtime when your app starts by setting it on ArcGISRuntimeEnvironment.

Basemaps

Review the basemap layer service and the variety of basemaps available. Create a new basemap using one of the enumeration values from BasemapStyle and use it to create your Map.

You can set an API key directly on the basemap or default to a global API key if one is set for the app.

                           
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

  const QString apiKey = QStringLiteral("YOUR_API_KEY");

  if (apiKey.isEmpty())
  {
      qWarning() << "Use of Esri location services, including basemaps, requires "
                    "you to authenticate with an ArcGIS identity or set the API Key property.";
  }
  else
  {

      ArcGISRuntimeEnvironment::setApiKey(apiKey);

  }



// Create a new 'topographic' basemap.
Basemap* basemap = new Basemap(BasemapStyle::ArcGISTopographic, this);

// Optionally, set a specific API key for the basemap.
// (Not required if a global API key is set)

basemap->setApiKey("YOUR_API_KEY");

// Create a map that uses the basemap.
Map* map = new Map(basemap, this);

Geocoding

Use the ArcGIS Platform Geocoding service and provide an API key, either globally for the app, or by setting it explicitly on your LocatorTask.

Routes and directions

Access to routing and directions APIs is unchanged with ArcGIS Platform. While authentication has always been required to access these services, ArcGIS Platform adds the ability to use these services with an API key in addition to ArcGIS identity.

See the Find routes and directions topic for more information.

Other services

See all the Location services available to you on ArcGIS Platform.

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