Display a web map
Overview
You will learn: how to build an app to load and display a web map from ArcGIS Online.
Applications can load and display 2D web maps that have been previously created with the Map Viewer or ArcGIS Pro. Web maps contain all of the settings required to set up the map such as the extent, basemap, layers and styles, pop-ups, and labels. Web maps are stored as items in ArcGIS Online or ArcGIS Enterprise. Web maps are loaded by accessing a portal and requesting an item by ID. All of the settings are applied to the map and layers when the item is loaded, saving you time from having to set them up yourself. Learn more about working with web maps in the Create a web map tutorial or by using ArcGIS Pro.
In this tutorial, you will build an app that loads and displays a pre-configured web map from ArcGIS Online.
Before you begin
You must have previously installed ArcGIS AppStudio.
Open the starter app project
If you completed the Create a starter app tutorial, start ArcGIS AppStudio and then open your starter app project. Otherwise, complete the tutorial now and open the project.
Steps
Preview the web map
- Go to the LA Trails and Parks map to view the map in the Map Viewer. Make note of the ID at the end of the URL.
Display a web map
Run ArcGIS AppStudio. Click your Starter app project in the App Gallery, 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
App
declaration, add the following properties to specify the portal URL and layer item ID.Use dark colors for code blocks Copy In the code editor, scroll down to the
Map
declaration. Update the declaration to load a web map using its the portal URL and the item ID. Remove the remainder of the code.Use dark colors for code blocks Copy In the lower left Sidebar, click Run or press Control-R/Command-R to run the app.
Congratulations, you're done!
Your map should contain trails and parks in the Santa Monica mountains. Compare your map with our completed solution project.