Create a web app

To create the web app for the park website, you'll use ArcGIS Instant Apps. Instant Apps includes a library of app templates and several configuration options so you can design an app tailored to your audience's needs.

Note:

If you need to create capabilities to engage with the public and promote outdoor recreation activities, use the Recreation Outreach Solution. This tutorial focuses on how to create web and native apps, and the steps described here form a subset to be considered for outdoor recreation engagement.

Choose a web app template

First, you'll sign in to ArcGIS Online and choose an appropriate template using Instant Apps.

  1. Sign in to your ArcGIS organizational account.
    Note:

    If you don't have an organizational account, see options for software access.

  2. On the ribbon, click Content.

    Content option

    You go to your Content page, which shows all of the content in your account. This page also includes options for creating content, including apps.

  3. Click Create app and choose Instant Apps.

    Instant Apps option in Create app menu

    The Instant Apps gallery page appears in a new browser tab. The gallery includes many app templates, which you can filter based on the capabilities they have. Because you want to eventually convert your web app into a native app using ArcGIS AppStudio, you'll search for templates that have compatibility with AppStudio.

  4. For Search app capabilities, type AppStudio and choose appstudio.

    Search box with AppStudio as the search word

    The gallery is filtered to templates with AppStudio compatibility as a capability. The other capability you want your app to have is to show the elevation of hiking trails.

    A good way to show elevation of a linear route (such as a trail) is with an elevation profile, which is a two-dimensional cross-sectional view of a landscape that depicts rises and falls in elevation. You'll filter the gallery further to show templates that have elevation profile capabilities.

  5. For Search app capabilities, type Elevation Profile and choose elevation profile.

    Search box with Elevation Profile as the search words

    The capability is added as a filter. The gallery now contains one item: the Nearby template. You'll check the app's description to confirm this is the app you want.

  6. For Nearby, click the options button and choose App description.

    App description option

    A window appears with a text description of the app. The description states that this template guides users to points of interest based on a location search and provides directions. In conjunction with the AppStudio and elevation profile capabilities, this template seems like exactly what you want to help park visitors search for and learn about nearby hiking trails.

  7. In the description window, click Close.
  8. For Nearby, click Choose.
    Tip:

    To preview an app template before you choose it, click Sample to see an example app using the template.

    Choose button for the Nearby template

    The Create App window appears, with options to give your app a title and search tags.

  9. For Give your app a title, type Santa Monica Mountains Hiking Trails.
  10. For Add tags, type Los Angeles and Hikes, pressing Enter after each.
  11. Optionally, choose a folder in which to save the app.

    Create App window with title and tags filled in

  12. Click Create App.

    The app is created and the app setup page appears.

Choose a map

Next, you'll configure the template to suit your needs. The first thing you'll do is choose a map to display in your app. This map will show hiking trails and trailheads in the Santa Monica Mountains.

  1. If necessary, close the Welcome to the app setup page window.

    The app setup page is set to express mode by default. This mode includes a simplified subset of all app settings to emphasize the most essential settings and guides you through the configuration process.

    You can turn off express mode to view all settings, or search for specific settings if you need them, but for your purposes, this mode is fine right now. The first step is to choose a map for your app.

  2. Click Step 1. Map.

    Step 1. Map option

    You'll choose a web map of Santa Monica hiking trails that has already been created for you. Ordinarily, you may have to create the map you want to display in your app yourself, but for the purposes of this tutorial, you'll assume you've already created the map.

    Note:

    To learn more about creating web maps, try Get started with ArcGIS Online.

  3. Click Select a map.

    Select a map button

    The Select a map window appears. By default, the window displays maps that you own. The map you'll use is owned by the Learn ArcGIS administrator account.

  4. Click My Content and choose ArcGIS Online.

    ArcGIS Online option

    The window now shows all maps that are shared publicly on ArcGIS Online.

  5. In the search bar, type Santa Monica Trails Nearby owner:Learn_ArcGIS.

    Santa Monica Trails Nearby search

    The list of maps is filtered to show a single result: Santa Monica Trails - Nearby, owned by Learn_ArcGIS.

  6. For Santa Monica Trails - Nearby, click Select a map.

    Select a map button in the search result

    The app preview updates to show the trails map.

    Map showing trails and trailheads in the Santa Monica Mountains

Configure the capabilities

An app doesn't just display a map. It also contains capabilities that change how users interact with and gain meaning from the app. The main capabilities you want your app to have are the ability to search for nearby trails, the ability to view elevation profiles of the trails, and the ability to show directions to trails.

First, you'll specify the search distance for visitors to find nearby trails and trailheads.

  1. In the configuration pane, click Back.

    Back button

    You return to the list of essential settings. The next step on the list is About, which you can adjust to change the text in the app to help users better understand how to use it. The app already contains default text that describes various search methods to find locations on the map, so you won't change this setting.

    The third step, Nearby, contains settings for the app's search capability.

  2. Click Step 3. Nearby.

    Step 3. Nearby option

    You'll choose the layers that will be included in the search results. You want users to be able to search for both trails and trailheads.

  3. For Layers to include in results, check SAMO Public Trailheads and Access Points and SAMO Public Trails.

    Layers to include in results setting

    The default search distance is 2 kilometers, which isn't very big considering the park has an area of 638 square kilometers (or about 246 square miles). You'll increase the distance and also change the unit of measurement to miles.

  4. For Maximum search distance, type 5. For Search units, choose miles.

    Maximum search distance and Search units parameters

    You've configured the search capability. Next, you'll configure an elevation profile capability that allows visitors to see trail elevation before they choose which trail to hike. The elevation profile is not included in the list of essential settings in the Express pane, so you'll search for it.

  5. Click Search settings.

    Search settings option

  6. In the Search settings pane, type Elevation and click Add elevation profile link to popup.

    Add elevation profile link to popup search result

    Because this setting isn't shown in express mode, you're prompted to turn off express mode before continuing.

  7. In the Turn off express mode window, click Continue.

    The Results pane appears, with all settings for search results available.

  8. Turn on Add elevation profile link to popup.

    Add elevation profile link to popup option

    Now, elevation profiles will be available for the trails layer.

    Another option that is displayed is the option to show directions. You want users to be able to see directions to reach trailheads, so you'll enable this option.

  9. Turn on Show directions. For Layers to include directions link in the results, choose SAMO Public Trailheads and Access Points.

    Show directions option

    You've enabled and configured all the capabilities you want your web app to have.

Finish the app

You'll add a few final changes to your app. First, you'll create a custom filter for the trails layer so visitors can search specifically for paved park roads.

  1. In the Results pane, click Back.
  2. Click Filter.

    Filter option

  3. Turn on Enable filtering. For Select layer, choose SAMO Public Trails.

    Enable filtering and Select layer parameters

  4. For Custom filters, click Add filter.

    To add the filter, you'll create an expression. The trails layer has attribute information for trail type, so you can use that information to create an expression that filters by the paved park road trail type.

  5. Click Add expression.

    Add expression button

  6. Create the expression Type is Paved park road.

    Expression that reads Type is Paved park road

    You'll also name the filter. This name will appear in the app, so it should explain what it filters by.

  7. For Filter display name, type Paved park road.

    Filter display name parameter

  8. Click Save.

    Another small feature you'll add is a button that enables users to switch the basemap to show satellite imagery of the area. This feature can be useful for users who want to get a better idea of what the terrain really looks like.

  9. In the configuration pane, click Interactivity.

    Interactivity option in the configuration pane

  10. In the Interactivity pane, click Modify.
  11. Turn on Basemap toggle. For Select basemap, click Imagery.

    Basemap toggle and Select basemap options

    Your web app is finished. It has all the features you wanted, and even more features that will help visitors plan their hikes.

Publish the app

All you need to do now is publish the app and share it so everyone can view it.

  1. Click the Publish button.

    Publish button

  2. In the Publish window, click Confirm.

    A window appears, asking whether you want to authorize premium content. The Santa Monica Mountains Hiking Trails layer is a premium service due to its routing capabilities.

    If you do not authorize premium content, users who do not have an ArcGIS account may not be able to see the trails layer when they use your app. If you do authorize premium content, your app will consume credits in your organization every time the app is viewed. You shouldn't authorize premium content unless you're certain your organization can sustain the cost.

    In this scenario, you're an official working for a government agency, so you would want to authorize premium content so all users can view the app's content. However, for the purposes of this tutorial, you'll leave premium content unauthorized to avoid unnecessarily spending credits.

  3. In the Authorize premium content window, click Continue without authorizing.

    Your app is published. The Share window appears with options to share your app. Currently, the app isn't shared. You'll share it with the public so everyone can see it.

    Note:

    Because you chose not to authorize premium content for the purposes of this tutorial, users who do not have an ArcGIS account may not be able to see the trails layer in the app.

  4. Click Change share settings.

    Change share settings option

  5. In the Share window, choose Everyone. Click Save.
  6. Click View Application.

    Your web app is finished and appears in a new browser tab. Anyone with the URL of the app will be able to access it.

    Next, you'll configure a native app with all the same functionality as the web app. When configuring the native app, you'll want to use the web app as a base, so you'll copy the web app's ID from the URL to refer to it later.

  7. Optionally, test some of your app's features, such as the search bar or the filter.
  8. In the URL, copy the string of letters and numbers after id=.

    ID in the URL

  9. Paste the ID somewhere you can easily access it again, such as a Notepad document and close the app.

    You'll use this ID later in the tutorial.

You've successfully created and published a web app using Instant Apps.


Create a native app

You've created a web app that park visitors can access online before they arrive. But many of the app's features are useful for users even after they've started their hike. To accommodate these users, you'll create a native app, which is an app that can be installed onto a smartphone and used offline. This app will contain the same features as the web app, as well as additional custom features that make use of smartphone hardware, such as text-to-speech functionality.

Note:

For your app to be able to work offline, your web map must contain offline areas. To learn how to make offline areas, see the tutorial Conduct a pre-enumeration survey.

Choose a native app template

To create the native app, you'll use ArcGIS AppStudio and choose the same template you used to create the web app.

  1. Open ArcGIS AppStudio.
    Note:

    If you don't have ArcGIS AppStudio, you can download it for free from the ArcGIS AppStudio Resources page. Run the downloaded file to open the installation wizard. Follow the wizard's instructions to install the software.

  2. Click Sign In and choose Sign In.

    Sign In option

  3. Sign in using your ArcGIS account.
  4. Click New App.

    New App button

    Note:

    If you've never created an app in AppStudio, the New App button may be in a different location than in the example image.

    The New App window appears. It lists several app templates and styles. You want to choose the Nearby template, which is the same one you used to create your web app.

  5. Click the Templates tab.

    Templates tab

  6. In the list of templates, click the Nearby template.

    Nearby template

    A summary and description appear for the selected template.

  7. Under the description, click Create.

    The app is created and listed with your other apps. If this is your first time using AppStudio, it will be your only app. A side pane provides more information about the app, including its name.

  8. In the list of apps, confirm that your new app is selected. In the side pane, click the Edit Title button.

    Edit Title button

  9. Change the title to Santa Monica Trails and click the Save Changes button.

    Save Changes button

Configure the settings

You want your app's design to represent your organization or the app's functionality. To increase the visual appeal and informative value of your app, you'll add images, descriptions, and icons. Then, you'll use the ID of the web app to add its functionality to the native app.

  1. Download the images zipped folder.
  2. Extract the images zipped folder to a location on your computer that you can easily remember, such as your Documents folder.

    The folder contains three images that you'll use to give your app distinct and consistent branding.

  3. In AppStudio, in the list of apps, confirm that your Santa Monica Trails app is selected. In the side pane, click Settings.

    Settings button

    The AppStudio Settings window appears. First, you'll update the thumbnail.

  4. In the AppStudio Settings window, on the Details tab, click the default thumbnail.

    Default thumbnail

  5. In the Open window, browse to and double-click the thumbnail-santa-monica-trails image from the folder you downloaded.

    Santa Monica Trails thumbnail

    A message appears, explaining that a copy of this image will replace your current thumbnail.

  6. Click Yes.

    The thumbnail is replaced. Next, you'll change the app's summary with a tagline that conveys the app's purpose.

  7. For Summary, delete the existing text and type Discover - Hike - Enjoy.

    You'll also add an icon to represent the app on smartphones and other devices.

  8. Click the Resources tab. For App Icon, click the default icon.

    Default icon

  9. In the Choose image window, browse to and double-click the icon-santa-monica-trails image from the folder you downloaded.

    Santa Monica Trails icon

  10. In the Copy File window, click Yes.

    The icon is added. You'll also add a background image.

  11. Click the Properties tab. On the Start Screen tab, for Background image, click the default background image.

    Default background image

  12. In the Open window, browse to and double-click the background-santa-monica-trails image from the folder you downloaded.

    Santa Monica Trails background

  13. In the Copy file window, click Yes.

    The background is added. You'll change the primary color of the app to match the green color of your images.

  14. For Brand color, type #339689.

    Brand color set to #339689

  15. At the bottom of the AppStudio Settings window, click Apply.

    Your changes are applied. The AppStudio Settings window remains open. You'll use this window to add the ID for your web app to the native app. Doing so will allow users to access the web app's functionality while using the native app.

  16. In the AppStudio Settings window, on the Properties tab, click the Gallery tab.
  17. For Nearby web apps, delete the existing text and paste the ID of your web app. Add id: to the beginning of the ID.

    Nearby web apps option

  18. Click Apply. After the settings are applied, close the AppStudio Settings window.

Test the app on a desktop

You've configured and customized your app. Now, you'll test it on your computer.

  1. In AppStudio, confirm that your Santa Monica Trails app is selected. In the side pane, click Run.

    Run button

    Your app opens in a new window.

    Native app on desktop

    The desktop app behaves similarly to how the app will function on a smartphone.

  2. Click Start.

    The app displays the map of trails and trailheads from your web app. The instructions explain the ways you can find nearby points of interest.

    Native app on desktop showing map of trails and trailheads

  3. Zoom in and out on the map.
  4. Click any location on the map.

    When you click the map, a pin appears with a 5-mile search radius around it. Any trails and trailheads within that radius are listed at the bottom of the app.

    Native app with a 5-mile search radius

  5. If necessary, click the map or scroll through the nearby trails until a trail is listed at the bottom of the app. For the trail, click Elevation.

    Elevation button

    The map zooms to the trail and displays an elevation profile that shows changes in elevation across the trail.

    Elevation profile in the native app

  6. Close the elevation profile. For the same trail you just looked at, click Details.

    Details button

    More information about the trail is displayed.

  7. Close the details page. On the map, click a trailhead (indicated by a black square with a hiker).
  8. For the trailhead, click Details.

    The details page for trailheads includes a Directions button. This button will show routing information to reach the trailhead. For the purposes of this tutorial, you won't add a key, although you can learn more at the topic License your app at the Lite level.

    When users run the app on a smartphone, they will see alternative routing options based on their smartphone's capabilities.

  9. Close the Santa Monica Trails app.

Customize your app with code

The Nearby template already contains all the code necessary for a usable native app. But what if you wanted your app to do more? By changing the app's code, you can add capabilities that would otherwise not be possible with the template alone.

Next, you'll edit your app's code to add text-to-speech functionality. This functionality will allow the app to use smartphone hardware to read out the name of and distance to the closest trailhead.

  1. In AppStudio, in the list of apps, confirm that your Santa Monica Trails app is selected. In the side pane, click Edit.

    Edit button

    Qt Creator opens, showing the code files associated with your app. The Nearby template has files that use Qt Modeling Language (QML), a language designed for creating user interface-centric applications such as apps.

    You'll add one new QML component to one of the QML files.

  2. If the Take a UI Tour window appears, click Cancel.
  3. In the Projects pane, in the Nearby folder, expand the Nearby folder and the views folder. Double-click the NearbyMapPage.qml file.

    NearbyMapPage.qml file

    The file is displayed in the editor pane of Qt Creator. Lines 17 through 31 of the file involve importing various libraries and frameworks necessary to run the rest of the code. First, you'll add a line to import an app framework that allows text-to-speech functionality.

  4. After line 28 (import ArcGIS.AppFramework.Platform 1.0), press Enter to add a line. On the new line (29), add the following code:
    import ArcGIS.AppFramework.Speech 1.0

    Import line on line 29

    Next, you'll add a QML component that uses the text-to-speech functionality. You'll give this component the ID tts (text-to-speech) so that you can refer to it when users search for trails.

  5. Scroll to line 124. Add the following component (be sure to keep the indentations):
    TextToSpeech {
        id: tts
    }

    TextToSpeech component

    You'll refer to the new QML component after the map layers are queried during a search. When users complete a search for nearby trails, the text-to-speech functionality will say the name of the trail and its distance away.

    Your code will use the tts component you added and the say component, which prompts the text-to-speech functionality to say something. Your code will define what is said by combining references to attributes of the features on the map and text strings.

  6. Scroll to about line 2600 (//if results are not empty). Depending on how you added the previous lines, the line number may be slightly different.

    This part of the code defines what is done if a search is completed and has valid results.

  7. After the line mapPageCarouselView.highlightResult(mapView.featuresModel.get(0).initialIndex); (about line 2606), press Enter. In the empty line, paste the following code:
    tts.say(mapView.featuresModel.get(0).search_attr + " is " + mapView.featuresModel.get(0).distance + " miles away");

    Component to read out the search result

    Tip:

    Alternatively, press Ctrl+F to find search for specific words.

  8. On the ribbon, click File and choose Save "NearbyMapPage.qml".
    Tip:

    Alternatively, press Ctrl+Shift+S to save your changes.

  9. Press Alt+Shift+R to run the project.

    The project runs and a window appears with general messages about the code. When the project finishes running, the desktop version of your app appears.

  10. If your desktop has text-to-speech functionality, start the app and click the map near a trail. (Ensure your desktop's volume is turned on.)

    Now, when you run the app on a device that has text-to-speech functionality, the closest search result is read out loud by your device.

  11. Close the desktop version of your app.

Upload your app

Your app is finished. You'll upload it to your ArcGIS organization. Optionally, you'll then test it on a mobile device.

  1. In AppStudio, confirm that you are signed in to your ArcGIS account.
  2. In the list of apps, confirm that your Santa Monica Trails app is selected. In the side pane, click Upload.

    Upload button

    The AppStudio Upload window appears. This window has options to share your trail with your organization or the public. For now, you won't share the app, although in a real-world scenario you would eventually want to share it publicly.

  3. In the AppStudio Upload window, click Upload.

    When the upload finishes, a message informs you that the upload was successful. If you make later changes to the app, you can update the app by uploading it again.

  4. Close the AppStudio Upload window.

    Optionally, you can test your app on a mobile device.

  5. On your Android or iOS mobile device, download and install ArcGIS AppStudio Player from Google Play or the Apple App Store.
    Note:

    You can also create an app installation .apk file for Android and an .exe file for Windows to install the native app on your device. These steps are the same for any AppStudio app. You can follow the steps described in the Create app installation files section of the Use ArcGIS AppStudio to build a 311 mobile app tutorial.

  6. Open AppStudio Player.
  7. Click Sign In. For ArcGIS Online, click Sign In and sign in using your ArcGIS account.

    Your list of apps appears. The list includes your trails app.

  8. For the Santa Monica Trails app, click the download button.
  9. Once the app finishes downloading, click it to open it.
  10. In the app, click the map near a trail and search for nearby trails. Confirm that the first result in the card carousel is read to you by your device. (You may need to turn on your device's volume.)

From one web map, you've created a web app that can be used in a browser and a customized native app that can be run on a smartphone. Your apps can be used by visitors to a national park to plan their trips more effectively.

You can use Instant Apps and AppStudio to create apps for a wide range of uses. Try out some of the other app templates to make engaging, interactive apps tailored to your needs and audience.

You can find more tutorials in the tutorial gallery.