Examples

Kanzi Maps comes with examples that demonstrate the features in Kanzi Maps. You can find these examples in the <KanziWorkspace>/Engine/plugins/maps/examples directory:

  • Kanzi Maps example in the maps_example directory

    ../_images/preview-example-maps.png
  • 3D terrain example in the maps_terrain3d directory

    ../_images/preview-example-terrain3d.png
  • Texturing example in the maps_texturing_sample directory

    ../_images/preview-example-texturing.png

Preparing an example project for building

To prepare a Kanzi Maps example project for building:

  1. In Kanzi Studio, open the project that is stored in the <example>/Tool_project directory.

  2. In the Kanzi Studio main menu, select Kanzi Maps > Set Up Kanzi Maps.

    This way, you copy the Kanzi Maps library files to the <example>/Application/bin directory.

    ../_images/set-up-kanzi-maps.png
  3. If Kanzi Studio asks whether you want to set the map plugin credentials, click Yes and set up your Mapbox credentials. See Setting up your Mapbox credentials.

    Kanzi Maps creates the <example>/Application/bin/map_settings.xml file and stores your backend and credentials in that file.

    ../_images/access-token-key.png
  4. In the File main menu, select Export > Export KZB.

    ../_images/export-kzb-binary.png

Building a Kanzi Maps example for Windows

To build a Kanzi Maps example application for Windows:

  1. Prepare the example project for building. See Preparing an example project for building.

  2. In the Windows Start menu in the Rightware directory, select Kanzi Command Prompt.

    When you have more than one version of Kanzi installed, make sure that you launch the Kanzi Command Prompt for the version of Kanzi with which you want to work in that command prompt.

    Tip

    To open the Kanzi Command Prompt in Kanzi Studio, select File > Open Kanzi Command Prompt.

  3. In the <KanziWorkspace>/Engine/plugins/maps/examples/<example>/Application directory, run the script that generates a Visual Studio solution for the example application.

    For example, if you use Visual Studio 2019, run

    generate_cmake_vs2019_solution.bat
    

    This script generates a Visual Studio solution for the application in the Application/build_vs2019 directory.

  4. To build the example application, go to the build_vs<Version> directory and run one of these commands depending on whether you want to use the release or debug build type:

    cmake --build . --target install --config Release
    
    cmake --build . --target install --config Debug
    

You can find the example application executable in the Application/bin/Win64/GL_vs<Version>_Release_DLL directory.

Building a Kanzi Maps example for Android

Building from Android Studio

To build a Kanzi Maps example application from Android Studio, open and build the <KanziWorkspace>/Engine/plugins/maps/examples/<example>/Application/configs/platforms/android_gradle Android Gradle project.

Building from the command line

To build a Kanzi Maps example application for Android using the command line:

  1. Prepare the example project for building. See Preparing an example project for building.

  2. In the Windows Start menu in the Rightware directory, select Kanzi Command Prompt.

    When you have more than one version of Kanzi installed, make sure that you launch the Kanzi Command Prompt for the version of Kanzi with which you want to work in that command prompt.

    Tip

    To open the Kanzi Command Prompt in Kanzi Studio, select File > Open Kanzi Command Prompt.

  3. In the <KanziWorkspace>/Engine/plugins/maps/examples/<example>/Application/configs/platforms/android_gradle directory, run one of these commands depending on whether you want to use the release or debug build type:

    gradlew assembleRelease
    
    gradlew assembleDebug
    

You can find the example application in the <example>/Application/configs/platforms/android_gradle/<ExampleProject>/build/outputs/apk directory.

Building a Kanzi Maps example for other platforms

To build a Kanzi Maps example application for other platforms:

  1. Prepare the example project for building. See Preparing an example project for building.

  2. In the Windows Start menu in the Rightware directory, select Kanzi Command Prompt.

    When you have more than one version of Kanzi installed, make sure that you launch the Kanzi Command Prompt for the version of Kanzi with which you want to work in that command prompt.

    Tip

    To open the Kanzi Command Prompt in Kanzi Studio, select File > Open Kanzi Command Prompt.

  3. In the <KanziWorkspace>/Engine/plugins/maps/examples/<example>/Application/configs/platforms/<platform> directory, run one of these commands depending on whether you want to use the release or debug build type:

    scons --dynamic release
    
    scons --dynamic debug
    

You can find the example application in the <example>/Application/output directory.

See also

Setting up Kanzi Maps

Tutorials