Create a starter app

Overview

You will learn: how to build a simple app that displays a 2D map.

You can build mapping applications to display geographic data in 2D with ArcGIS AppStudio. Use the ArcGIS AppStudio QML project template that is pre-configured to display a basemap using the Map QML type. You can either use a basemap that is hosted in ArcGIS Online or create your own basemap with custom styles. If you want to add data to your map, you can add points, lines, polygons as graphics. For larger datasets, you can learn how to add data to feature layers with the Add layers to a map tutorial. Basemaps can be loaded by URL or by using the Basemap QML types. The MapView QML type is responsible for displaying the map and handling user interactions.

In this tutorial, you will build a simple app that displays a topographic vector basemap of the Santa Monica Mountains in California. You will use this tutorial as the starting point for most of the other ArcGIS AppStudio tutorials.

Before you begin

You must have previously installed ArcGIS AppStudio.

Steps

Create a starter project

  1. Run ArcGIS AppStudio. Click New App. In the New App window, click the Hello World (Runtime) template. Set the Title to Starter app. Click Create.

  2. In the App Gallery, click the Starter app project, and then click Edit. This will open your project in Qt Creator.

  3. In the Qt Creator Projects window, double-click MyApp.qml to open it in the editor.

  4. In the code editor, scroll down to the Map declaration. Update the definition to load the topographic vector basemap and set the map position to the Santa Monica mountains:

    Use dark colors for code blocksCopy
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
        // add a basemap
        Map {
            id:map
    
            // *** UPDATE ***
            //BasemapTopographic{}
            //initialViewpoint: ViewpointCenter {
            //    id:initialViewpoint
            //    center: Point {
            //        x: -11e6
            //        y: 6e6
            //        spatialReference: SpatialReference {wkid: 102100}
            //     }
            //    targetScale: 9e7
            //}
    
            BasemapTopographicVector {}
            initialViewpoint: ViewpointCenter {
                id:initialViewpoint
                center: Point {
                    x: -118.80543                                        // Longitude
                    y: 34.02700                                          // Latitude
                    spatialReference: SpatialReference { wkid: 4326 }    // WGS84
                }
                targetScale: 100000
            }
    
        }
  5. In the lower left Sidebar, click Run or press Control-R/Command-R to run the app.

Congratulations, you're done!

Your app should run and display the basemap. Compare your solution with our completed solution project. This project is reused as the starting template for many of the ArcGIS AppStudio tutorials.

Your browser is no longer supported. Please upgrade your browser for the best experience. See our browser deprecation post for more details.