×
Download Example | Maps SDK for Qt | General Magic Download Example — Maps & Navigation SDKs documentation
Skip to content

Download Example

In this guide you will learn how to download maps, voices and map styles from the GeneralMagic Online Store for offline use.

Content Download

QML content download example

First, get an API key token, see the Getting Started guide.

Qt should be installed to continue.

The Maps SDK for Qt should be installed, see the Setup Maps SDK for Qt guide.

Overview

ContentDownload demonstrates how to download items from the GeneralMagic Online Store for offline use. This example presents a drop-down menu to select the type of content to download, such as maps, voices, or map styles.

How it works

In Qt, go to the File menu and select Open File or Project…

QML content download example

then browse to the ContentDownload example folder and open ContentDownload.pro

You may want to have a look at Setting your API Key to see how to open and configure a project and set your API Key.

Setting the download location

If GENERAL_MAGIC_DATA_PATH is not defined, then the default implicit download location is:

QStandardPaths::writableLocation(QStandardPaths::CacheLocation)
+ QStringLiteral("/GeneralMagic")

and this is where Data/Maps is located.

To set GENERAL_MAGIC_DATA_PATH, the following line can be added in main():

qputenv("GENERAL_MAGIC_DATA_PATH", "/var/GeneralMagic/Downloads");

where /var/GeneralMagic/Downloads is any path where the user application has read and write permissions.

To download maps

Select Road Maps from the drop-down menu, and a new view appears with 2 text fields and a checkbox at the top.

QML content download example maps

If the [x]Local content only checkbox is checked, then only maps which have been already downloaded are shown in the list, if any.

Make sure the [ ]Local content only checkbox is not checked to see all maps available for download.

QML content download example maps

Typing one or more letters in the Filter content (left) text field shortens the list to show only countries/regions containing that sequence of letters in their name.

Click on the country/region name to download.

QML content download example maps

In the panel that appears, click the DOWNLOAD button.

Click the top left corner icon to go back to the previous menu.

To download voices

Select Human Voice from the menu, and a new view appears with 2 text fields and a checkbox at the top.

QML content download example maps

If the [x]Local content only checkbox is checked, then only voices which have been already downloaded are shown in the list, if any.

Make sure the [ ]Local content only checkbox is not checked to see all voices available for download.

Typing one or more letters in the Filter content (left) text field shortens the list to show only the voices containing that sequence of letters in their name.

Click on the voice name to download.

QML content download example maps

In the panel that appears, click the DOWNLOAD button.

Click the top left corner icon to go back to the previous menu.

To download map styles

QML content download example maps

Select View Style from the drop-down menu (either normal or high dpi), and a new view appears with 2 text fields and a checkbox at the top.

QML content download example maps

If the [x]Local content only checkbox is checked, then only map styles which have been already downloaded are shown in the list, if any.

Make sure the [ ]Local content only checkbox is not checked to see all map styles available for download.

Typing one or more letters in the Filter content (left) text field shortens the list to show only map styles containing that sequence of letters in their name. For example, you can type ele to see only map styles with elevation/topography.

Click on the map style name to download.

QML content download example maps

In the panel that appears, click the DOWNLOAD button.

Click the top left corner icon to go back to the previous menu.

QML Examples

Maps SDK for Qt Examples can be downloaded or cloned with Git