Display a map (UI)

Learn how to set a basemap, elevation source, and add data layers, as well as display a specific area using the Map Creator UI and the High Definition Render Pipeline from Unity.

In this tutorial, you will create a local scene in Unity that contains a basemap layer service and data layers.

Local scene UI

Prerequisites

Before starting this tutorial, you should:

  1. You need an ArcGIS Developer account or ArcGIS Online account and an API key to access ArcGIS services. If you don't have an account, sign up for free.

  2. Ensure your development environment meets the system requirements.

  3. Follow install and setup steps and install the plugin. Make sure to import the sample assets.

  4. Create a new HDRP project.

If you are not familiar with Unity's interface, see Unity Manual for information about the most common editor windows, and how to make full use of them.

Steps

Create a new scene and open the Map Creator UI

  1. In the top menu, click File > New Scene and open the pop-up window.

    Create a new scene
  2. Select Basic Outdoors (HDRP) template and click the Create button, then save the scene with a scene name.

    Select Basic Outdoors (HDRP) template
  3. In the top menu, click ArcGIS Maps SDK > Map Creator. Adjust the windows size after opening the Map Creator UI if it is needed.

    Open the Map Creator UI

Create a map

In this tutorial, you will create a local scene and set a circular extent.

  1. Click the Map tab and display the panel content.

  2. Click Local in the Map Type section.

  3. In the Origin Position section you can set up the center of your GIS scene with its coordinates and a spatial reference Well-Known ID (WKID). For the tutorial, set the parameters to these values:

    • Longitude: -74
    • Latitude: 41
    • Altitude: 0
    • Spatial Reference WKID: 4326

    For information regarding the spatial reference, see the spatial references page.

  4. Check the Enable Map Extent check box to display the Map Extent section and set the extent of the map to these values:

    • Longitude: -74.0
    • Latitude: 40.72
    • Shape: Circle
    • Spatial Reference WKID: 4326
    • Shape Dimensions: 5000
  5. Click Create Map to add ArcGIS Map game object to the scene.

This is the result of the Map panel.

Create a local scene

In the Hierarchy window, you can find the ArcGISMap game object created.

ArcGISMap game object

When you click the ArcGISMap game object in the Hierarchy window, you can see that the game object has the ArcGIS Map component attached.

ArcGIS Map component

For more information about creating an ArcGIS Map, refer to the Maps page.

Create and set up a camera

ArcGIS Maps SDK for Unity will show higher resolution LODs for areas closer to the camera and lower resolution LODs for the areas that are further away from the camera.

  1. Click the Camera tab.

  2. The Camera Position defines the initial point of view of the camera. Set the parameters to these values:

    • Longitude: -74.054921
    • Latitude: 40.691242
    • Altitude: 3000
    • Spatial Reference WKID: 4326
  3. The Camera Rotation defines the angle of the camera.

    • Heading: 55
    • Pitch: 58
    • Roll: 0
  4. Click the Create Camera button.

This is the result of the Camera panel.

Create a camera

In the Hierarchy window, you can find the Main Camera game object has been converted to ArcGISCamera game object and moved under ArcGISMap game object.

ArcGISMap camera object

When you double-click the ArcGISCamera game object, your Scene view camera will be moved to the position. If you also want to adjust pitch, heading, and roll, you should do so by holding the right mouse button down in the Scene view.

At this point, you may want to disable Fog in the Sky and Fog Volume to see the basemap and data layers you will add. At the last of this tutorial, you will adjust the lighting.

Disable Fog

For information about the camera, see the Camera page.

Set basemap

In this tutorial, you will select a basemap from a preset option.

  1. Click the Basemap tab and display the panel content.

  2. Select the Imagery basemap from the preset basemap gallery.

This is the result of setting up the basemap to Imagery from the preset.

Set basemap

Set the API key

The preset basemap that is selected in the previous section requires an API key.

  1. Go to your developer dashboard to get your API key.

  2. Click the Auth tab to display the panel content.

  3. Set the API key in the API Key section.

Make sure your API key is in the field where you see Paste your API key here in this screenshot. You can find the information about how to get API keys by clicking on Get an API Key in the UI.

Set the API key

Another way to set up a global API key for multiple scenes in your Unity project is through the project settings. For more information about the API key, refer to the API keys section.

After switching back to the Basemap tab, the previously grayed-out basemap icons should now be enabled, indicating that the API key successfully registered.

Set basemap

At this point, you should see the map data with the local extent. If you cannot see anything in the Scene view, open the Hierarchy window and double-click the ArcGIS Camera to move the editor camera position, then adjust the angle to see the map.

Map preview

Set elevation

In this tutorial, you will use the default elevation to define the terrain.

  1. Click the Elevation tab and display the panel content.

  2. Make sure Terrain 3D is selected and the Enable All checkbox is checked.

This is the result of the elevation panel.

Set elevation

Add data layers

You will add operational data from ArcGIS Online.

  • ArcGIS Online item: UrbanObservatory_NYC_TransitFrequency

    • Layer name: 01 - New York Transit Frequency
    • Type: ArcGIS Image Layer
    • Online service URL (source):
    Use dark colors for code blocksCopy
    1
    https://tiles.arcgis.com/tiles/nGt4QxSblgDfeJn9/arcgis/rest/services/UrbanObservatory_NYC_TransitFrequency/MapServer
    • Opacity: 0.9
  • ArcGIS Online item: New_York_Industrial

    • Layer name: 02 - New York Industrial Areas
    • Type: ArcGIS Image Layer
    • Online service URL (source):
    Use dark colors for code blocksCopy
    1
    https://tiles.arcgis.com/tiles/nGt4QxSblgDfeJn9/arcgis/rest/services/New_York_Industrial/MapServer
    • Opacity: 0.6
  • ArcGIS Online item: NewYorkCity_PopDensity

    • Layer name: 03 - New York Population Density
    • Type: ArcGIS Image Layer
    • Online service URL (source):
    Use dark colors for code blocksCopy
    1
    https://tiles.arcgis.com/tiles/4yjifSiIG17X0gW4/arcgis/rest/services/NewYorkCity_PopDensity/MapServer
    • Opacity: 1.0
  • ArcGIS Online item: New York, USA Buildings

    • Layer name: 04 - New York Buildings
    • Type: ArcGIS 3D Object Scene Layer
    • Online service URL (source):
    Use dark colors for code blocksCopy
    1
    https://tiles.arcgis.com/tiles/P3ePLMYs2RVChkJx/arcgis/rest/services/Buildings_NewYork_17/SceneServer
    • Opacity: 1.0

Follow these steps to add each layer.

  1. Click the Layers tab.

  2. In the Add Data section, select the appropriate layer type from the drop-down list in Type.

  3. Enter the layer's online service URL in the Source field to add an image tile layer.

  4. Type the layer name in the Name field.

  5. Click the Add button to add the layer to your map. Once it is added, it will appear in the Layers section.

  6. Move the Opacity slider or type the exact value in the Opacity field to set the layer opacity.

This is the result of the Layers panel.

Add data

Adjust sky and lighting

Unity provides a sky and lighting system. See the Sky and lighting page for more information. In this tutorial, you will adjust the settings for the game objects that were added by the template.

Adjust the Sun

  1. In the Hierarchy window, click the Sun game object.

  2. In the Inspector window, set the rotation to the following values in Transform section.

    • X: 36
    • Y: 110
    • Z: 85
  3. Open the Emission section and set the Intensity value to 10000.

This is the result of the Sun game object.

Adjust the Sun

Adjust the Sky and Fog Volume

  1. Click the Sky and Fog Volume in the Hierarchy window.

  2. ArcGIS Maps SDK for Unity has a sample profile for Sky and Fog volume for HDRP. click the icon next to the Profile name in the Inspector window Volume section.

  3. Select the Sky and Fog Settings SampleScenes Profile in the pop-up window.

    Sky and Fog Settings SampleScenes Profile

Attach a camera controller

During the editor time, you have the Scene view camera to navigate around in the viewport when the Editor mode is enabled. For the play mode, you must attach a camera controller to explore your scene. In this tutorial, you will attach a controller from the ArcGIS Maps SDK for Unity's sample assets.

  1. Click the ArcGISCamera in the the Hierarchy window.

  2. In the Inspector window, click the Add Component button.

  3. Search for the ArcGIS Camera Controller and attach it to the ArcGISCamera game object.

    Attach ArcGIS Camera Controller

You have successfully configured a map with the Map Creator UI. Click the Play icon on the Toolbar and see your map in the Game view.

Use the WASD keys to move left/right/forward/backward. Use the left mouse button to pan around the scene, the right button to orbit and the scroll wheel to zoom in or out.

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