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. ::: labs-info If Qt Creator does not open then review the ArcGIS AppStudio installation instructions and verify you have the Qt SDK properly set up. :::

  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: ::: labs-info Use the vector tile version of the topographic basemap. Review the documentation for basemap QML types.

    The center point value keeps the initial viewpoint centered and focused on the Santa Monica Mountains. The scale value sets the level of detail to focus on the area of interest.

    The spatial reference is set to use World Geodetic System 1984 (WGS84), the spatial reference commonly used for GPS, and it has the well known id 4326. To learn more, see the guide topic about spatial references. :::

                                
    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. ::: labs-info Run the app from within ArcGIS AppStudio by clicking the app in the App Gallery and then clicking the Run icon from the tool pallette.

    In Qt Creator, there are several ways to run the project:

    • Press Control-R/Command-R on the keyboard.
    • In the app menu, click Build > Run.
    • Click the Run button from the tool palette. :::

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.