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 basemapMap QML type. You can either use a basemap that is hosted in ArcGIS OnlineBasemap QML types. The Map 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
-
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. -
In the App Gallery, click the Starter app project, and then click Edit. This will open your project in Qt Creator.
-
In the Qt Creator Projects window, double-click MyApp.qml to open it in the editor.
-
In the code editor, scroll down to the
Mapdeclaration. Update the definition to load the topographic vector basemap and set the map position to the Santa Monica mountains:Use dark colors for code blocks Copy // 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 } } -
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.