Skip To Content ArcGIS for Developers Sign In Dashboard

Overview

You will learn: how to create a simple starter app that displays a basemap. This template project will be used in subsequent tutorials.

With the ArcGIS Runtime SDK for Qt it's easy to create a simple starter app that displays a basemap. You can choose from a wide variety of vector and tile ArcGIS Online basemaps to build different types of applications. These basemaps can be loaded by URL and common ArcGIS Online basemaps, like the vector street and topographic vector basemaps, are provided as QML types. In order to set the location of the map, you can set the map view to a certain location on earth by specifying the latitude, longitude, and scale.

In this tutorial you will use the ArcGIS Runtime SDK for Qt to build a simple mapping app that displays a topographic vector basemap and zooms to the Santa Monica Mountains in California.

Before you begin

You must have previously installed the ArcGIS Runtime SDK for Qt and set up the development environment for your operating system.

Steps

Create a new ArcGIS Runtime App Qt Creator Project

  1. Start Qt Creator.

  2. Choose File > New File or Project and select the ArcGIS project template for ArcGIS Runtime 100.5.0 Qt Quick app. Give your app a name. For this tutorial we chose Qt_Starter_App, but you can choose any name that suits you. Also select the location where your project files should reside on your system. Select Continue.

  3. On the Define Project Details dialog, leave the settings as suggested. Select Continue.

  4. On the Kit Selection dialog, check the kits you previously setup when you installed the SDK. Select Continue.

  5. Verify your selections and select Done.

Change the basemap

  1. Open the main.qml code file in your project (Resources > qml > qml.qrc > /qml > main.qml). If you followed the prior steps, it should already be open in the IDE. You will update the ApplicationWindow QML component to display the topographic vector basemap and set the location of the map to the Santa Monica Mountains.

  2. Update the the Map component in the MapView component to use the topographic vector basemap.

    Map {
        BasemapTopographicVector {}
    }
    

Change the location

  1. Inside the Map QML component add the following ViewpointCenter QML component.

    Map {
    
        BasemapTopographicVector {}
    
        // Add the following to set the location of the map
        ViewpointCenter {
            center: Point {
                x: -118.80543                                        // Longitude
                y: 34.02700                                          // Latitude
                spatialReference: SpatialReference { wkid: 4326 }    // WGS84
            }
            targetScale: 300000
        }
    }
    
  2. Run your code to view the map.

Congratulations, you're done!

Challenge

Explore basemaps

ArcGIS Online hosts a wide variety of basemaps that you can use in your applications.

Learn how to create and use your own custom basemaps with the Style a vector basemap and Display a styled vector basemap tutorial.