Using offline maps in demos¶
This topic explains how to generate and use offline map tiles and routes for demonstration purposes. You create offline maps by saving map areas and recording routes in Kanzi Studio. You can set Kanzi Maps to use the offline maps when no network connectivity is available.
Note
The generation of offline map tiles and routes for demos is supported by the Mapbox and TomTom backends. Using offline map data in production is not supported.
Using offline map tiles¶
Use the Map Control to generate offline map tiles that you can use for demonstration purposes. The generation of offline map tiles is supported by the Mapbox and TomTom backends.
Generating offline tiles¶
To generate offline tiles:
In the Kanzi Maps main menu, select Settings.
Go to the Advanced tab and in Offline Tile manager, set:
Folder to the path to the directory where you want to store the offline map tiles
You can use an absolute path or a path relative to the
Application/bin/
directory of your project.Enabled to enabled
Click OK.
The Preview restarts and Kanzi Studio creates a directory for the offline map tiles in the location that you set in the Folder. The directory contains a subdirectory for your backend.
For example,
Application/bin/offlineTiles/Maps.MapboxBackend/
.Make sure that you leave the Preview running.
In the Kanzi Maps main menu, select User Preferences, and make sure that the Bing Maps Key is set to your Bing Maps key.
In Kanzi Studio, you select the offline map area from a Bing Maps map.
To learn how to create a Bing Maps key, see https://docs.microsoft.com/en-us/bingmaps/getting-started/bing-maps-dev-center-help/getting-a-bing-maps-key.
In the Kanzi Maps main menu, select Map Control.
Go the Offline Tiles tab and click From Map.
In the Select Area dialog, pan and zoom the map to the area for which you want to store offline map tiles. Click Select Currently Visible Area and close the dialog.
In the Map Control, set the maximum zoom level and name for the offline tile package and click Save.
If the number of tiles to fetch is acceptable, click Yes to accept the tile fetch. Your map account can have a limitation on the the number of tiles to fetch.
Kanzi Maps fetches the tiles and stores them in the directory that you set in the Offline Tile manager Folder.
For example, if you use the default offline tiles directory, use Mapbox, and named you offline tile package LowerManhattan, Kanzi Maps stores the tiles in the Application/bin/offlineTiles/Maps.MapboxBackend/LowerManhattan
directory.
Using offline tiles¶
To use offline tiles:
Delete the cache folder of your map backend.
For example, delete the
Application/bin/mapbox_cache
directory.This way, you make sure that Kanzi Maps does not fetch from the cache any tiles that you did not save as offline tiles.
In the Kanzi Maps main menu, select Settings and on the Advanced tab, enable the Offline Tile manager.
The offline tile manager goes through all packages in the directory that you set in the Offline Tile manager Folder and generates map areas for the available tiles.
To enable the use of the offline tiles, set the Offline mode to enabled in either:
The Settings > Advanced tab.
The Map Control > Control tab.
In the Map Control, you can enable and disable the use of offline tiles while the Preview is running.
(Optional) To restrict the scrolling of the map to the offline map areas, in the Settings or Map Control, set the Offline bounds to enabled.
Using offline routes¶
Use the Map Control to generate offline routes that you can use for demonstration purposes. The generation of offline routes is supported by the Mapbox and TomTom backends.
Generating offline routes¶
To generate offline routes:
In the Kanzi Maps main menu, select Settings.
Go to the Advanced tab and in Offline Route manager, set:
Folder to the path to the directory where you want to store the offline routes
You can use an absolute path or a path relative to the
Application/bin/
directory of your project.Enabled to enabled
Click OK.
The Preview restarts and Kanzi Studio creates a directory for the offline routes in the location that you set in the Folder. The directory contains a subdirectory for your backend.
For example,
Application/bin/offlineRoutes/Maps.MapboxBackend/
.Make sure that you leave the Preview running.
In the Kanzi Maps main menu, select User Preferences, and make sure that the Bing Maps Key is set to your Bing Maps key.
In Kanzi Studio, you select the offline route from a Bing Maps map.
To learn how to create a Bing Maps key, see https://docs.microsoft.com/en-us/bingmaps/getting-started/bing-maps-dev-center-help/getting-a-bing-maps-key.
In the Kanzi Maps main menu, select Map Control and go to the Navigation tab.
On the Navigation tab, click Add/Edit to open the offline route editing dialog.
Click From Map.
Double-click the map to drop a pin for the start point of the route and click Set Start Point.
Double-click the map to drop a pin for the end point of the route and click Set End Point.
Close the map window.
In the Add/Edit dialog, set:
Package to the offline route package in which you want to store this route.
Route to the name that you want to use for this route.
Click Save.
In the Map Control, click Save Offline.
Using offline routes¶
To use offline routes:
In the Kanzi Maps main menu, select Settings and on the Advanced tab, enable Offline Route manager.
The offline route manager goes through all packages in the directory that you set in the Offline Route manager Folder and generates the offline routes.
In the Kanzi Maps main menu, select Map Control and go to the Navigation tab.
On the Navigation tab, select the offline route for which you want to simulate navigation, and click Start/Continue.