Add StreetMap Premium data

StreetMap Premium for ArcGIS Runtime provides enriched street data, which powers a high-quality cartographic map 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 MMPK 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 World Geocoding Service, Routing Service, and Street Map 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.

Note:

StreetMap Premium for ArcGIS Runtime is updated regularly, for example: North America three times per year, Europe two times per year, and Latin America, Asia Pacific, Middle East and Africa once per year.

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

  1. Download StreetMap Premium mobile map package(s) required by your app. When you're ready to deploy your app, you'll need to license StreetMap Premium for each extension (region) your app uses.
    License:

    You do not need a license for developing and testing with StreetMap Premium data. StreetMap Premium for ArcGIS Runtime is included with your ArcGIS Developer subscription. When you deploy an app using StreetMap Premium data, you will need to license your app as described in the License StreetMap Premium section of this topic.

  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 will 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.

// ArcGIS Runtime license key
let myRuntimeLicenseKey = "runtimelite,1000,rudxxxxxxxxx,28-feb-2019,xxxxxxxxxxxxxxxxxxxx"

// Extension license keys for various StreetMap Premium areas
let smpNorthAmerica = "runtimesmpna,1000,rudxxxxxxxxx,13-mar-2018,xxxxxxxxxxxxxxxxxxxx"
let smpLatinAmerica = "runtimesmpla,1000,rudxxxxxxxxx,13-mar-2018,xxxxxxxxxxxxxxxxxxxx"
let smpEurope = "runtimesmpe,1000,rudxxxxxxxxx,16-dec-2018,xxxxxxxxxxxxxxxxxxxx"

// Set the license for ArcGIS Runtime and the three extensions (areas)
do {
 try AGSArcGISRuntimeEnvironment.setLicenseKey(myRuntimeLicenseKey, extensions: [smpEurope, smpLatinAmerica, smpNorthAmerica])
 print("Licensed SMP extensions")
}
catch {
 print(error)
}

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.

// ... code here to read license keys from a text file into an array of strings ...
// Variable to store the (one) ArcGIS Runtime license key
var runtimeLicense = ""
// Variable to store the extension license keys (all others in the file)
var extensionLicenses = [""]
// Loop through all license keys from the file
for licenseKey in licenseKeys {
 if licenseKey.starts(with: "runtimelite") ||
  licenseKey.starts(with: "runtimebasic") ||
  licenseKey.starts(with: "runtimestandard") ||
  licenseKey.starts(with: "runtimeadvanced") {
  runtimeLicense = licenseKey
 }
 else {
  extensionLicenses.append(licenseKey)
 }
}
// Set the licenses before using any ArcGIS Runtime objects
do {
 try AGSArcGISRuntimeEnvironment.setLicenseKey(runtimeLicense, extensions: extensionLicenses)
 print("Licensed SMP extensions")
}
catch {
 print(error)
}

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

//get the licensing info for the current app
let licenseInfo = AGSArcGISRuntimeEnvironment.license()
//get all extension licenses
let extensionLicenses = licenseInfo.extensions
//loop through extension licenses and see when each expires
for extensionLicense in extensionLicenses {
 let extensionName = extensionLicense.name
 //get the expiry date
 let expiryDate = extensionLicense.expiry
 let today = Date()
 if let expiryDate = expiryDate {
  //get the number of days until the license expires
  let days = Calendar.current.dateComponents([.day], from: expiryDate, to: Date()).day
  if let days = days {
   //if within 10 days of expiration, notify the user
   if days <= 10 {
    print("Warning: License will expire in \(days) days")
   }
  }
}

License:

If you're building an app for a third-party who isn't part of your ArcGIS organization, then that third party must purchase the license directly from Esri and provide the license key(s) to you. For details, see the terms of use.

For details about licensing your ArcGIS Runtime app, see License your app.

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.

StreetMap Day map (left) and Navigation Day map (right)

// Open a StreetMap Premium mobile map package
let indianaPackage = AGSMobileMapPackage(name: "IndianaMobileMapPackage")
        
// Get the first map
let map = indianaPackage.maps.first
        
// Add it to the map view
self.mapView.map = map

Caution:

While StreetMap Premium data may support some capabilities outside of geocoding, routing, and map display (such as query, spatial analysis, and filtering of individual data layers) it is neither intended nor designed for such uses.

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.

// Get the locator task for this area
let locatorTask = indianaPackage.locatorTask
        
// Get geocode candidates
locatorTask?.geocode(withSearchText: "Indianapolis Motor Speedway", completion: { (results, error) in
 if let error = error {
  print(error)
  return
 }
 // Get the candidate with the best score
 guard let results = results else {return}
 //process the results
})

For more information on geocoding, see Search for places (geocoding).

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 map must be loaded before you can access the transportation dataset it contains.

// Get the (first and only) street network dataset from one of the maps in the package
let network = self.map.transportationNetworks.first
guard let streetNetwork = network else {return}
// Create a new route task that uses the street network
let routeTask = AGSRouteTask(dataset: streetNetwork)
// Get the default route parameters from the task and solve the route
/...

See Find a route for more information about working with a route task.