Offline Maps

With preloaded offline maps you can access whole countries or even continents completely offline without using any internet connection or consuming OTA bandwith.

Offline maps offer the same features as the map data that is available online: You can search for places, calculate routes, start guidance (only available for the Navigate Edition), and - of course - you can interact with the map in the same way as with online map data.

Why use offline maps? In most situations - when limited bandwidth and data consumption is not an issue - accessing online map data offers more accurate and up-to-date map data. Also, some features may not be available on offline maps, for example, search results may contain not all data that is available online. However, there can be situations when an internet connection may lag, drop - or is completely off for a longer time. Especially, while on-the-go, a stable connection may not always be available. A mobile device may also be offline due to the user's decision to save bandwidth. This means: There can be multiple reasons to use offline maps - and last but not least, offline maps will speed up the user's experience with unbeatable response times.

You have two ways to access map data offline:

  • Local Cache: By default, all map data is cached onto the device while using the map. This storage is persisted between sessions, but the storage size is limited and old cache data may be replaced with newer map data. Note: You can change the default cache path and the size with the SDKOptions you can pass into the SDKNativeEngine when you initialize the HERE SDK programmatically.

  • Offline Maps: With offline maps you can download entire regions or even continents to preload their map data for offline use - including places, routing and other data. A dedicated MapDownloader enables you to get and to maintain this data. Offline maps data is persisted between sessions and the data will not be deleted unless the user decides so. In this section, we describe how this works.

Offline maps work for all map schemes that are vector based. Satellite based map schemes are not part of the downloaded map data.

Good to know:

While interacting with a map view, the HERE SDK will first check if downloaded offline map data is available and show it. If no offline maps are available for the current target, the HERE SDK will download online map data and cache it. If no online connection is available, it will try to find data in the map data cache. If even that fails, the map will be shown with less details or even no details.

When the HERE SDK uses backend services such as for search and routing, you need to use dedicated offline engines to access cached or predownloaded offline map data. Use the OfflineSearchEngine and OfflineRoutingEngine to access map data offline. Their counterparts, the SearchEngine and RoutingEngine, will only provide results when an online connection is available - otherwise you will get an error. Therefore, you need to decide which engine to use.

Currently, only car routes are supported.


Downloading and using offline maps can be achived in two simple steps.

1) Download a list of Region objects. Optionally, this list can be localized with local region names. Once you have this list, you can pick the RegionId you want to download and pass it as download request to the MapDownloader.

2) Use the MapDownloader to download a single Region or a list of regions. You can also download several regions in parallel. Show the download progress to the user by setting a MapDownloaderStatusListener.

Once the download has completed, the map is ready to be used. If a device is offline, it will automatically show the downloaded region when the camera's target is pointed to that region.

If a download failed, the HERE SDK will still be in a fully operable state. Just try to download again, until the progress has reached 100% and the status finally indicated that the operation has completed. Note that, currently, map data can only be deleted manually from the device's storage.

Since map data for regions, countries or whole continents can contain several hundreds of megabytes, a download may take a while - depending on factors such as available bandwidth. A download may also fail, when a connection gets timed out and cannot recover. For best user experience, it is recommended to allow the user to cancel ongoing operations and to watch the progress until a map download succeeds.

Screenshot: Showing an example how downloadable maps could be indicated to users.

A usage example is available on GitHub as part of the offline_maps_app example app. More code snippets and examples will follow soon.

results matching ""

    No results matching ""