Add StreetMap Premium data

StreetMap Premium for ArcGIS Runtime provides enriched street data, which powers a high-quality cartographic maps and high-quality search, geocoding, and route analysis. StreetMap Premium maps are consistent across all regions of the world and can be taken offline for disconnected use; they can simultaneously fulfill the need for an address locator, street network dataset, and basemap in your app.

StreetMap Premium delivers data from HERE Technologies as a mobile map package (an .mmpk file) for your app to access locally. This format allows the data to be accessed offline (without a network connection, in other words) and therefore doesn't consume data from your user's data plan. This is the same high-quality data used by ArcGIS Online services, including the Geocoding service, Routing service, and Basemap layer service. Instead of spending your time putting together such datasets yourself, you can focus on developing apps that provide advanced searching, geocoding, and routing analysis offline.

StreetMap Premium data is organized into regions that are licensed as extensions to ArcGIS Runtime and are downloaded individually (North America, Latin America, Europe, the Middle East, Africa, and Asia Pacific), allowing your apps to provide a consistent user experience across the globe. Within these regions, maps are available at the sub-region, country, or state/province level. You can even use ArcGIS Pro to clip the data to a custom area of interest.

How to add StreetMap Premium data

Follow these general steps to use StreetMap Premium in your ArcGIS Runtime app.

  1. Download the StreetMap Premium Greater Los Angeles mobile map package that is provided for development and testing. When you're ready to deploy your app, you'll need to download the required StreetMap Premium packages from My Esri and license StreetMap Premium for each extension (region) your app uses.

  2. Provide the data (mobile map package) for your app. You can provide package(s) with your app or allow the user to download them as needed. Once the package (*.mmpk) is available on the client, you can open it to retrieve data, maps, and locators. Using the contents of the package, you can:

  3. Attribute StreetMap Premium data somewhere in the app user interface using the words mapping data from HERE. If you're attributing more than one data provider, the HERE attribution cannot be less prominent than the attribution for the other data providers. See Attribution in your app for more information.

License StreetMap Premium

Each StreetMap Premium region is licensed as an extension to ArcGIS Runtime. A StreetMap Premium extension license works with all license levels of ArcGIS Runtime (Lite, Basic, Standard, and Advanced). Unlike other ArcGIS Runtime extension licenses, this license does not unlock API capabilities, but rather licenses the use of StreetMap Premium data within one of the available regions. For each region you license, you receive a license key as a "string" to use in your app. These licenses are good for one year, so you must provide a mechanism to notify your users and update the license key for your app when (or before) the license expires.

The following code licenses ArcGIS Runtime and several StreetMap Premium extensions when the app initializes. To update these license keys when they expire, you will need to update and recompile the app code.

                                                                                                                                            
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
133
134
135
136
137
138
139
140
//

// ArcGIS Runtime license key
String runtimeLicenseKey = "runtimelite,1000,rudxxxxxxxxx,28-feb-2023,xxxxxxxxxxxxxxxxxxxx";

// Extension license keys for various StreetMap Premium areas

String smpNorthAmerica = "runtimesmpna,1000,rudxxxxxxxxx,13-mar-2023,xxxxxxxxxxxxxxxxxxxx";
String smpLatinAmerica = "runtimesmpla,1000,rudxxxxxxxxx,13-mar-20123,xxxxxxxxxxxxxxxxxxxx";
String smpEurope = "runtimesmpe,1000,rudxxxxxxxxx,16-dec-2023,xxxxxxxxxxxxxxxxxxxx";

// Add StreetMap Premium license keys to an array
List extensions = new ArrayList<>();
extensions.add(smpNorthAmerica);
extensions.add(smpLatinAmerica);
extensions.add(smpEurope);

// Set the license for ArcGIS Runtime and the three extensions (areas)
ArcGISRuntimeEnvironment.setLicense(runtimeLicenseKey, extensions);

// Initialize the ArcGIS Runtime before any components are created
ArcGISRuntimeEnvironment.initialize();



// ... code here to read a file that has one runtime license key and some extension license keys ...

// Stores ArcGIS Runtime license key
String runtimeLicenseKey = "";

// Stores all extension license keys

List extensions = new ArrayList<>();

// Loop through license keys from file
for (String license : arrayListOfLicenseKeys) {
  // Check if it is a Runtime license key
  if (license.startsWith("runtimelite") || license.startsWith("runtimebasic") ||
    license.startsWith("runtimestandard") || license.startsWith("runtimeadvanced")) {
    // Store license key
    runtimeLicenseKey = license;
  } else {
    extensions.add(license);
  }
}

// Set license using license key and any extension licenses
ArcGISRuntimeEnvironment.setLicense(runtimeLicenseKey, extensions);

// Initialize the ArcGIS Runtime before any components are created
ArcGISRuntimeEnvironment.initialize();



// Get the current licensing information
License license = ArcGISRuntimeEnvironment.getLicense();

// Get all extension licenses
List extensionLicenses = license.getExtensions();
// Loop through extension licenses and see when each expires
for (ExtensionLicense extension : extensionLicenses) {

  // Get license name and data of expiration

  String licenseName = extension.getExtensionName();
  Calendar date = extension.getExpiry();

  // Get number of days till license expires
  final long timeLeft = date.getTimeInMillis() - System.currentTimeMillis();
  final int millisecondsADay = (1000 * 60 * 60 * 24);
  final long daysLeft = timeLeft / millisecondsADay;

  // Warn user of days left on license if under 10 days
  if (daysLeft <= 10) {
    System.out.println("Days left till " + licenseName + " expires: " + daysLeft);
  }
}



// Open a StreetMap Premium mobile map package
MobileMapPackage mobileMapPackage = new MobileMapPackage("path/to/file/.mmpk");

mobileMapPackage.addDoneLoadingListener(() -> {
  if (mobileMapPackage.getLoadStatus() == LoadStatus.LOADED && mobileMapPackage.getMaps().size() > 0) {
    // Get the first map, which is the navigation map
    ArcGISMap navigationMap = mobileMapPackage.getMaps().get(0);

    // Add it to the map view
    mapView.setMap(navigationMap);
  }
});



// Open a StreetMap Premium mobile map package
MobileMapPackage indianaPackage = new MobileMapPackage("path/to/file/Indiana.mmpk");
indianaPackage.addDoneLoadingListener(() -> {
  // Get the locator task for this area
  LocatorTask locatorTask = indianaPackage.getLocatorTask();

  ListenableFuture> result = locatorTask.geocodeAsync("Indianapolis Motor Speedway");
  result.addDoneListener(() -> {
    try {
      // Get the candidate with the best score
      List geoCodeResults = result.get();
      geoCodeResults.sort((car1, car2) -> Double.compare(car2.getScore(), car1.getScore()));
      System.out.println("Best Score: " + geoCodeResults.get(0));
    } catch (InterruptedException | ExecutionException e) {
      e.printStackTrace();
    }
  });
});



// Get the (first and only) street network data set from one of the maps in the package
TransportationNetworkDataset streetNetwork = mobileMapPackageMap.getTransportationNetworks().get(0);

// Create a new route task that uses the street network
RouteTask routeTask = new RouteTask(streetNetwork);
routeTask.loadAsync();

// Create two stops and add them to a list
List stops = Arrays.asList(new Stop(fromMapPoint), new Stop(toMapPoint));

// Get the default route parameters from the task
ListenableFuture result = routeTask.createDefaultParametersAsync();
result.addDoneListener(() -> {
  try {
    RouteParameters defaultRouteParams = result.get();
    // Clears any existing stops and sets the one passed
    defaultRouteParams.setStops(stops);

    // Solve the route
    RouteResult solveRouteResult = routeTask.solveRouteAsync(defaultRouteParams).get();
  } catch (InterruptedException | ExecutionException e) {
    e.printStackTrace();
  }
});

You could also read license keys on startup from a text file included with the app and set the licenses. This would allow the user to update license keys in a separate file and would eliminate the need for you to update and recompile the app code.

                                                                                                                                            
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
133
134
135
136
137
138
139
140
//

// ArcGIS Runtime license key
String runtimeLicenseKey = "runtimelite,1000,rudxxxxxxxxx,28-feb-2023,xxxxxxxxxxxxxxxxxxxx";

// Extension license keys for various StreetMap Premium areas

String smpNorthAmerica = "runtimesmpna,1000,rudxxxxxxxxx,13-mar-2023,xxxxxxxxxxxxxxxxxxxx";
String smpLatinAmerica = "runtimesmpla,1000,rudxxxxxxxxx,13-mar-20123,xxxxxxxxxxxxxxxxxxxx";
String smpEurope = "runtimesmpe,1000,rudxxxxxxxxx,16-dec-2023,xxxxxxxxxxxxxxxxxxxx";

// Add StreetMap Premium license keys to an array
List extensions = new ArrayList<>();
extensions.add(smpNorthAmerica);
extensions.add(smpLatinAmerica);
extensions.add(smpEurope);

// Set the license for ArcGIS Runtime and the three extensions (areas)
ArcGISRuntimeEnvironment.setLicense(runtimeLicenseKey, extensions);

// Initialize the ArcGIS Runtime before any components are created
ArcGISRuntimeEnvironment.initialize();



// ... code here to read a file that has one runtime license key and some extension license keys ...

// Stores ArcGIS Runtime license key
String runtimeLicenseKey = "";

// Stores all extension license keys

List extensions = new ArrayList<>();

// Loop through license keys from file
for (String license : arrayListOfLicenseKeys) {
  // Check if it is a Runtime license key
  if (license.startsWith("runtimelite") || license.startsWith("runtimebasic") ||
    license.startsWith("runtimestandard") || license.startsWith("runtimeadvanced")) {
    // Store license key
    runtimeLicenseKey = license;
  } else {
    extensions.add(license);
  }
}

// Set license using license key and any extension licenses
ArcGISRuntimeEnvironment.setLicense(runtimeLicenseKey, extensions);

// Initialize the ArcGIS Runtime before any components are created
ArcGISRuntimeEnvironment.initialize();



// Get the current licensing information
License license = ArcGISRuntimeEnvironment.getLicense();

// Get all extension licenses
List extensionLicenses = license.getExtensions();
// Loop through extension licenses and see when each expires
for (ExtensionLicense extension : extensionLicenses) {

  // Get license name and data of expiration

  String licenseName = extension.getExtensionName();
  Calendar date = extension.getExpiry();

  // Get number of days till license expires
  final long timeLeft = date.getTimeInMillis() - System.currentTimeMillis();
  final int millisecondsADay = (1000 * 60 * 60 * 24);
  final long daysLeft = timeLeft / millisecondsADay;

  // Warn user of days left on license if under 10 days
  if (daysLeft <= 10) {
    System.out.println("Days left till " + licenseName + " expires: " + daysLeft);
  }
}



// Open a StreetMap Premium mobile map package
MobileMapPackage mobileMapPackage = new MobileMapPackage("path/to/file/.mmpk");

mobileMapPackage.addDoneLoadingListener(() -> {
  if (mobileMapPackage.getLoadStatus() == LoadStatus.LOADED && mobileMapPackage.getMaps().size() > 0) {
    // Get the first map, which is the navigation map
    ArcGISMap navigationMap = mobileMapPackage.getMaps().get(0);

    // Add it to the map view
    mapView.setMap(navigationMap);
  }
});



// Open a StreetMap Premium mobile map package
MobileMapPackage indianaPackage = new MobileMapPackage("path/to/file/Indiana.mmpk");
indianaPackage.addDoneLoadingListener(() -> {
  // Get the locator task for this area
  LocatorTask locatorTask = indianaPackage.getLocatorTask();

  ListenableFuture> result = locatorTask.geocodeAsync("Indianapolis Motor Speedway");
  result.addDoneListener(() -> {
    try {
      // Get the candidate with the best score
      List geoCodeResults = result.get();
      geoCodeResults.sort((car1, car2) -> Double.compare(car2.getScore(), car1.getScore()));
      System.out.println("Best Score: " + geoCodeResults.get(0));
    } catch (InterruptedException | ExecutionException e) {
      e.printStackTrace();
    }
  });
});



// Get the (first and only) street network data set from one of the maps in the package
TransportationNetworkDataset streetNetwork = mobileMapPackageMap.getTransportationNetworks().get(0);

// Create a new route task that uses the street network
RouteTask routeTask = new RouteTask(streetNetwork);
routeTask.loadAsync();

// Create two stops and add them to a list
List stops = Arrays.asList(new Stop(fromMapPoint), new Stop(toMapPoint));

// Get the default route parameters from the task
ListenableFuture result = routeTask.createDefaultParametersAsync();
result.addDoneListener(() -> {
  try {
    RouteParameters defaultRouteParams = result.get();
    // Clears any existing stops and sets the one passed
    defaultRouteParams.setStops(stops);

    // Solve the route
    RouteResult solveRouteResult = routeTask.solveRouteAsync(defaultRouteParams).get();
  } catch (InterruptedException | ExecutionException e) {
    e.printStackTrace();
  }
});

As the licenses in your app near expiration, you might want to notify the user that new licensing information will be required soon.

The following code loops through all extension licenses for the app and notifies the user if a license is within 10 days of expiring.

                                                                                                                                            
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
133
134
135
136
137
138
139
140
//

// ArcGIS Runtime license key
String runtimeLicenseKey = "runtimelite,1000,rudxxxxxxxxx,28-feb-2023,xxxxxxxxxxxxxxxxxxxx";

// Extension license keys for various StreetMap Premium areas

String smpNorthAmerica = "runtimesmpna,1000,rudxxxxxxxxx,13-mar-2023,xxxxxxxxxxxxxxxxxxxx";
String smpLatinAmerica = "runtimesmpla,1000,rudxxxxxxxxx,13-mar-20123,xxxxxxxxxxxxxxxxxxxx";
String smpEurope = "runtimesmpe,1000,rudxxxxxxxxx,16-dec-2023,xxxxxxxxxxxxxxxxxxxx";

// Add StreetMap Premium license keys to an array
List extensions = new ArrayList<>();
extensions.add(smpNorthAmerica);
extensions.add(smpLatinAmerica);
extensions.add(smpEurope);

// Set the license for ArcGIS Runtime and the three extensions (areas)
ArcGISRuntimeEnvironment.setLicense(runtimeLicenseKey, extensions);

// Initialize the ArcGIS Runtime before any components are created
ArcGISRuntimeEnvironment.initialize();



// ... code here to read a file that has one runtime license key and some extension license keys ...

// Stores ArcGIS Runtime license key
String runtimeLicenseKey = "";

// Stores all extension license keys

List extensions = new ArrayList<>();

// Loop through license keys from file
for (String license : arrayListOfLicenseKeys) {
  // Check if it is a Runtime license key
  if (license.startsWith("runtimelite") || license.startsWith("runtimebasic") ||
    license.startsWith("runtimestandard") || license.startsWith("runtimeadvanced")) {
    // Store license key
    runtimeLicenseKey = license;
  } else {
    extensions.add(license);
  }
}

// Set license using license key and any extension licenses
ArcGISRuntimeEnvironment.setLicense(runtimeLicenseKey, extensions);

// Initialize the ArcGIS Runtime before any components are created
ArcGISRuntimeEnvironment.initialize();



// Get the current licensing information
License license = ArcGISRuntimeEnvironment.getLicense();

// Get all extension licenses
List extensionLicenses = license.getExtensions();
// Loop through extension licenses and see when each expires
for (ExtensionLicense extension : extensionLicenses) {

  // Get license name and data of expiration

  String licenseName = extension.getExtensionName();
  Calendar date = extension.getExpiry();

  // Get number of days till license expires
  final long timeLeft = date.getTimeInMillis() - System.currentTimeMillis();
  final int millisecondsADay = (1000 * 60 * 60 * 24);
  final long daysLeft = timeLeft / millisecondsADay;

  // Warn user of days left on license if under 10 days
  if (daysLeft <= 10) {
    System.out.println("Days left till " + licenseName + " expires: " + daysLeft);
  }
}



// Open a StreetMap Premium mobile map package
MobileMapPackage mobileMapPackage = new MobileMapPackage("path/to/file/.mmpk");

mobileMapPackage.addDoneLoadingListener(() -> {
  if (mobileMapPackage.getLoadStatus() == LoadStatus.LOADED && mobileMapPackage.getMaps().size() > 0) {
    // Get the first map, which is the navigation map
    ArcGISMap navigationMap = mobileMapPackage.getMaps().get(0);

    // Add it to the map view
    mapView.setMap(navigationMap);
  }
});



// Open a StreetMap Premium mobile map package
MobileMapPackage indianaPackage = new MobileMapPackage("path/to/file/Indiana.mmpk");
indianaPackage.addDoneLoadingListener(() -> {
  // Get the locator task for this area
  LocatorTask locatorTask = indianaPackage.getLocatorTask();

  ListenableFuture> result = locatorTask.geocodeAsync("Indianapolis Motor Speedway");
  result.addDoneListener(() -> {
    try {
      // Get the candidate with the best score
      List geoCodeResults = result.get();
      geoCodeResults.sort((car1, car2) -> Double.compare(car2.getScore(), car1.getScore()));
      System.out.println("Best Score: " + geoCodeResults.get(0));
    } catch (InterruptedException | ExecutionException e) {
      e.printStackTrace();
    }
  });
});



// Get the (first and only) street network data set from one of the maps in the package
TransportationNetworkDataset streetNetwork = mobileMapPackageMap.getTransportationNetworks().get(0);

// Create a new route task that uses the street network
RouteTask routeTask = new RouteTask(streetNetwork);
routeTask.loadAsync();

// Create two stops and add them to a list
List stops = Arrays.asList(new Stop(fromMapPoint), new Stop(toMapPoint));

// Get the default route parameters from the task
ListenableFuture result = routeTask.createDefaultParametersAsync();
result.addDoneListener(() -> {
  try {
    RouteParameters defaultRouteParams = result.get();
    // Clears any existing stops and sets the one passed
    defaultRouteParams.setStops(stops);

    // Solve the route
    RouteResult solveRouteResult = routeTask.solveRouteAsync(defaultRouteParams).get();
  } catch (InterruptedException | ExecutionException e) {
    e.printStackTrace();
  }
});

Display StreetMap Premium data

Inside each StreetMap Premium mobile map package, you'll find two maps: Navigation Day and StreetMap Day. Each of these maps display the same data and use similar symbology for the layers. They also use scale dependent rendering to improve display performance and readability. The Navigation Day map, however, displays streets with a wider symbol and with more and larger labels, as illustrated in the following image. You can choose the map that best suits the use case, device, screen size, and so on for your app.

Street map (left) and Navigation map (right)

The following example opens a StreetMap Premium mobile map package file and displays the Navigation Day map in the app's map view.

                                                                                                                                            
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
133
134
135
136
137
138
139
140
//

// ArcGIS Runtime license key
String runtimeLicenseKey = "runtimelite,1000,rudxxxxxxxxx,28-feb-2023,xxxxxxxxxxxxxxxxxxxx";

// Extension license keys for various StreetMap Premium areas

String smpNorthAmerica = "runtimesmpna,1000,rudxxxxxxxxx,13-mar-2023,xxxxxxxxxxxxxxxxxxxx";
String smpLatinAmerica = "runtimesmpla,1000,rudxxxxxxxxx,13-mar-20123,xxxxxxxxxxxxxxxxxxxx";
String smpEurope = "runtimesmpe,1000,rudxxxxxxxxx,16-dec-2023,xxxxxxxxxxxxxxxxxxxx";

// Add StreetMap Premium license keys to an array
List extensions = new ArrayList<>();
extensions.add(smpNorthAmerica);
extensions.add(smpLatinAmerica);
extensions.add(smpEurope);

// Set the license for ArcGIS Runtime and the three extensions (areas)
ArcGISRuntimeEnvironment.setLicense(runtimeLicenseKey, extensions);

// Initialize the ArcGIS Runtime before any components are created
ArcGISRuntimeEnvironment.initialize();



// ... code here to read a file that has one runtime license key and some extension license keys ...

// Stores ArcGIS Runtime license key
String runtimeLicenseKey = "";

// Stores all extension license keys

List extensions = new ArrayList<>();

// Loop through license keys from file
for (String license : arrayListOfLicenseKeys) {
  // Check if it is a Runtime license key
  if (license.startsWith("runtimelite") || license.startsWith("runtimebasic") ||
    license.startsWith("runtimestandard") || license.startsWith("runtimeadvanced")) {
    // Store license key
    runtimeLicenseKey = license;
  } else {
    extensions.add(license);
  }
}

// Set license using license key and any extension licenses
ArcGISRuntimeEnvironment.setLicense(runtimeLicenseKey, extensions);

// Initialize the ArcGIS Runtime before any components are created
ArcGISRuntimeEnvironment.initialize();



// Get the current licensing information
License license = ArcGISRuntimeEnvironment.getLicense();

// Get all extension licenses
List extensionLicenses = license.getExtensions();
// Loop through extension licenses and see when each expires
for (ExtensionLicense extension : extensionLicenses) {

  // Get license name and data of expiration

  String licenseName = extension.getExtensionName();
  Calendar date = extension.getExpiry();

  // Get number of days till license expires
  final long timeLeft = date.getTimeInMillis() - System.currentTimeMillis();
  final int millisecondsADay = (1000 * 60 * 60 * 24);
  final long daysLeft = timeLeft / millisecondsADay;

  // Warn user of days left on license if under 10 days
  if (daysLeft <= 10) {
    System.out.println("Days left till " + licenseName + " expires: " + daysLeft);
  }
}



// Open a StreetMap Premium mobile map package
MobileMapPackage mobileMapPackage = new MobileMapPackage("path/to/file/.mmpk");

mobileMapPackage.addDoneLoadingListener(() -> {
  if (mobileMapPackage.getLoadStatus() == LoadStatus.LOADED && mobileMapPackage.getMaps().size() > 0) {
    // Get the first map, which is the navigation map
    ArcGISMap navigationMap = mobileMapPackage.getMaps().get(0);

    // Add it to the map view
    mapView.setMap(navigationMap);
  }
});



// Open a StreetMap Premium mobile map package
MobileMapPackage indianaPackage = new MobileMapPackage("path/to/file/Indiana.mmpk");
indianaPackage.addDoneLoadingListener(() -> {
  // Get the locator task for this area
  LocatorTask locatorTask = indianaPackage.getLocatorTask();

  ListenableFuture> result = locatorTask.geocodeAsync("Indianapolis Motor Speedway");
  result.addDoneListener(() -> {
    try {
      // Get the candidate with the best score
      List geoCodeResults = result.get();
      geoCodeResults.sort((car1, car2) -> Double.compare(car2.getScore(), car1.getScore()));
      System.out.println("Best Score: " + geoCodeResults.get(0));
    } catch (InterruptedException | ExecutionException e) {
      e.printStackTrace();
    }
  });
});



// Get the (first and only) street network data set from one of the maps in the package
TransportationNetworkDataset streetNetwork = mobileMapPackageMap.getTransportationNetworks().get(0);

// Create a new route task that uses the street network
RouteTask routeTask = new RouteTask(streetNetwork);
routeTask.loadAsync();

// Create two stops and add them to a list
List stops = Arrays.asList(new Stop(fromMapPoint), new Stop(toMapPoint));

// Get the default route parameters from the task
ListenableFuture result = routeTask.createDefaultParametersAsync();
result.addDoneListener(() -> {
  try {
    RouteParameters defaultRouteParams = result.get();
    // Clears any existing stops and sets the one passed
    defaultRouteParams.setStops(stops);

    // Solve the route
    RouteResult solveRouteResult = routeTask.solveRouteAsync(defaultRouteParams).get();
  } catch (InterruptedException | ExecutionException e) {
    e.printStackTrace();
  }
});

Locate addresses and places

In addition to street data and maps, each StreetMap Premium mobile map package contains a locator task. Use the locator task to geocode addresses, intersections, or places of interest within the area covered by the package.

The following example opens a StreetMap Premium mobile map package file, gets the associated LocatorTask, and uses it to find a location.

                                                                                                                                            
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
133
134
135
136
137
138
139
140
//

// ArcGIS Runtime license key
String runtimeLicenseKey = "runtimelite,1000,rudxxxxxxxxx,28-feb-2023,xxxxxxxxxxxxxxxxxxxx";

// Extension license keys for various StreetMap Premium areas

String smpNorthAmerica = "runtimesmpna,1000,rudxxxxxxxxx,13-mar-2023,xxxxxxxxxxxxxxxxxxxx";
String smpLatinAmerica = "runtimesmpla,1000,rudxxxxxxxxx,13-mar-20123,xxxxxxxxxxxxxxxxxxxx";
String smpEurope = "runtimesmpe,1000,rudxxxxxxxxx,16-dec-2023,xxxxxxxxxxxxxxxxxxxx";

// Add StreetMap Premium license keys to an array
List extensions = new ArrayList<>();
extensions.add(smpNorthAmerica);
extensions.add(smpLatinAmerica);
extensions.add(smpEurope);

// Set the license for ArcGIS Runtime and the three extensions (areas)
ArcGISRuntimeEnvironment.setLicense(runtimeLicenseKey, extensions);

// Initialize the ArcGIS Runtime before any components are created
ArcGISRuntimeEnvironment.initialize();



// ... code here to read a file that has one runtime license key and some extension license keys ...

// Stores ArcGIS Runtime license key
String runtimeLicenseKey = "";

// Stores all extension license keys

List extensions = new ArrayList<>();

// Loop through license keys from file
for (String license : arrayListOfLicenseKeys) {
  // Check if it is a Runtime license key
  if (license.startsWith("runtimelite") || license.startsWith("runtimebasic") ||
    license.startsWith("runtimestandard") || license.startsWith("runtimeadvanced")) {
    // Store license key
    runtimeLicenseKey = license;
  } else {
    extensions.add(license);
  }
}

// Set license using license key and any extension licenses
ArcGISRuntimeEnvironment.setLicense(runtimeLicenseKey, extensions);

// Initialize the ArcGIS Runtime before any components are created
ArcGISRuntimeEnvironment.initialize();



// Get the current licensing information
License license = ArcGISRuntimeEnvironment.getLicense();

// Get all extension licenses
List extensionLicenses = license.getExtensions();
// Loop through extension licenses and see when each expires
for (ExtensionLicense extension : extensionLicenses) {

  // Get license name and data of expiration

  String licenseName = extension.getExtensionName();
  Calendar date = extension.getExpiry();

  // Get number of days till license expires
  final long timeLeft = date.getTimeInMillis() - System.currentTimeMillis();
  final int millisecondsADay = (1000 * 60 * 60 * 24);
  final long daysLeft = timeLeft / millisecondsADay;

  // Warn user of days left on license if under 10 days
  if (daysLeft <= 10) {
    System.out.println("Days left till " + licenseName + " expires: " + daysLeft);
  }
}



// Open a StreetMap Premium mobile map package
MobileMapPackage mobileMapPackage = new MobileMapPackage("path/to/file/.mmpk");

mobileMapPackage.addDoneLoadingListener(() -> {
  if (mobileMapPackage.getLoadStatus() == LoadStatus.LOADED && mobileMapPackage.getMaps().size() > 0) {
    // Get the first map, which is the navigation map
    ArcGISMap navigationMap = mobileMapPackage.getMaps().get(0);

    // Add it to the map view
    mapView.setMap(navigationMap);
  }
});



// Open a StreetMap Premium mobile map package
MobileMapPackage indianaPackage = new MobileMapPackage("path/to/file/Indiana.mmpk");
indianaPackage.addDoneLoadingListener(() -> {
  // Get the locator task for this area
  LocatorTask locatorTask = indianaPackage.getLocatorTask();

  ListenableFuture> result = locatorTask.geocodeAsync("Indianapolis Motor Speedway");
  result.addDoneListener(() -> {
    try {
      // Get the candidate with the best score
      List geoCodeResults = result.get();
      geoCodeResults.sort((car1, car2) -> Double.compare(car2.getScore(), car1.getScore()));
      System.out.println("Best Score: " + geoCodeResults.get(0));
    } catch (InterruptedException | ExecutionException e) {
      e.printStackTrace();
    }
  });
});



// Get the (first and only) street network data set from one of the maps in the package
TransportationNetworkDataset streetNetwork = mobileMapPackageMap.getTransportationNetworks().get(0);

// Create a new route task that uses the street network
RouteTask routeTask = new RouteTask(streetNetwork);
routeTask.loadAsync();

// Create two stops and add them to a list
List stops = Arrays.asList(new Stop(fromMapPoint), new Stop(toMapPoint));

// Get the default route parameters from the task
ListenableFuture result = routeTask.createDefaultParametersAsync();
result.addDoneListener(() -> {
  try {
    RouteParameters defaultRouteParams = result.get();
    // Clears any existing stops and sets the one passed
    defaultRouteParams.setStops(stops);

    // Solve the route
    RouteResult solveRouteResult = routeTask.solveRouteAsync(defaultRouteParams).get();
  } catch (InterruptedException | ExecutionException e) {
    e.printStackTrace();
  }
});

Solve routes

Maps in a StreetMap Premium package have an associated transportation network dataset. You can use this dataset to solve routes between two or more locations in the street network. The maps must be loaded before you can access the transportation dataset it contains.

The following example gets a TransportationNetworkDataset from a map in the StreetMap Premium package, then uses it to create a new RouteTask.

                                                                                                                                            
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
133
134
135
136
137
138
139
140
//

// ArcGIS Runtime license key
String runtimeLicenseKey = "runtimelite,1000,rudxxxxxxxxx,28-feb-2023,xxxxxxxxxxxxxxxxxxxx";

// Extension license keys for various StreetMap Premium areas

String smpNorthAmerica = "runtimesmpna,1000,rudxxxxxxxxx,13-mar-2023,xxxxxxxxxxxxxxxxxxxx";
String smpLatinAmerica = "runtimesmpla,1000,rudxxxxxxxxx,13-mar-20123,xxxxxxxxxxxxxxxxxxxx";
String smpEurope = "runtimesmpe,1000,rudxxxxxxxxx,16-dec-2023,xxxxxxxxxxxxxxxxxxxx";

// Add StreetMap Premium license keys to an array
List extensions = new ArrayList<>();
extensions.add(smpNorthAmerica);
extensions.add(smpLatinAmerica);
extensions.add(smpEurope);

// Set the license for ArcGIS Runtime and the three extensions (areas)
ArcGISRuntimeEnvironment.setLicense(runtimeLicenseKey, extensions);

// Initialize the ArcGIS Runtime before any components are created
ArcGISRuntimeEnvironment.initialize();



// ... code here to read a file that has one runtime license key and some extension license keys ...

// Stores ArcGIS Runtime license key
String runtimeLicenseKey = "";

// Stores all extension license keys

List extensions = new ArrayList<>();

// Loop through license keys from file
for (String license : arrayListOfLicenseKeys) {
  // Check if it is a Runtime license key
  if (license.startsWith("runtimelite") || license.startsWith("runtimebasic") ||
    license.startsWith("runtimestandard") || license.startsWith("runtimeadvanced")) {
    // Store license key
    runtimeLicenseKey = license;
  } else {
    extensions.add(license);
  }
}

// Set license using license key and any extension licenses
ArcGISRuntimeEnvironment.setLicense(runtimeLicenseKey, extensions);

// Initialize the ArcGIS Runtime before any components are created
ArcGISRuntimeEnvironment.initialize();



// Get the current licensing information
License license = ArcGISRuntimeEnvironment.getLicense();

// Get all extension licenses
List extensionLicenses = license.getExtensions();
// Loop through extension licenses and see when each expires
for (ExtensionLicense extension : extensionLicenses) {

  // Get license name and data of expiration

  String licenseName = extension.getExtensionName();
  Calendar date = extension.getExpiry();

  // Get number of days till license expires
  final long timeLeft = date.getTimeInMillis() - System.currentTimeMillis();
  final int millisecondsADay = (1000 * 60 * 60 * 24);
  final long daysLeft = timeLeft / millisecondsADay;

  // Warn user of days left on license if under 10 days
  if (daysLeft <= 10) {
    System.out.println("Days left till " + licenseName + " expires: " + daysLeft);
  }
}



// Open a StreetMap Premium mobile map package
MobileMapPackage mobileMapPackage = new MobileMapPackage("path/to/file/.mmpk");

mobileMapPackage.addDoneLoadingListener(() -> {
  if (mobileMapPackage.getLoadStatus() == LoadStatus.LOADED && mobileMapPackage.getMaps().size() > 0) {
    // Get the first map, which is the navigation map
    ArcGISMap navigationMap = mobileMapPackage.getMaps().get(0);

    // Add it to the map view
    mapView.setMap(navigationMap);
  }
});



// Open a StreetMap Premium mobile map package
MobileMapPackage indianaPackage = new MobileMapPackage("path/to/file/Indiana.mmpk");
indianaPackage.addDoneLoadingListener(() -> {
  // Get the locator task for this area
  LocatorTask locatorTask = indianaPackage.getLocatorTask();

  ListenableFuture> result = locatorTask.geocodeAsync("Indianapolis Motor Speedway");
  result.addDoneListener(() -> {
    try {
      // Get the candidate with the best score
      List geoCodeResults = result.get();
      geoCodeResults.sort((car1, car2) -> Double.compare(car2.getScore(), car1.getScore()));
      System.out.println("Best Score: " + geoCodeResults.get(0));
    } catch (InterruptedException | ExecutionException e) {
      e.printStackTrace();
    }
  });
});



// Get the (first and only) street network data set from one of the maps in the package
TransportationNetworkDataset streetNetwork = mobileMapPackageMap.getTransportationNetworks().get(0);

// Create a new route task that uses the street network
RouteTask routeTask = new RouteTask(streetNetwork);
routeTask.loadAsync();

// Create two stops and add them to a list
List stops = Arrays.asList(new Stop(fromMapPoint), new Stop(toMapPoint));

// Get the default route parameters from the task
ListenableFuture result = routeTask.createDefaultParametersAsync();
result.addDoneListener(() -> {
  try {
    RouteParameters defaultRouteParams = result.get();
    // Clears any existing stops and sets the one passed
    defaultRouteParams.setStops(stops);

    // Solve the route
    RouteResult solveRouteResult = routeTask.solveRouteAsync(defaultRouteParams).get();
  } catch (InterruptedException | ExecutionException e) {
    e.printStackTrace();
  }
});

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