Add layers (C++ API)
Learn how to add and manage layers by using the C++ API with an example of New York.
In this tutorial, you'll add raster tile layers, 3D object scene layers from ArcGIS Online in a global scene or local scene. Also, you'll learn how to add local files, how to manage layers such as set visibility, reorder and remove layers.
Prerequisites
Before starting this tutorial, you should:
Follow the C++ tutorials in display the globe (C++ API) or display a specific area (C++ API).
Steps
Open your .cpp file and add necessary headers in the include list.
Use dark colors for code blocks Copy In the function
Create
, add a raster tile layer (image tile layer) by using the class nameA r c GISMap() UArcGISImage
. Get theLayer arc
layer array fromGISMap arc
by usingGISMap Get
and add the layer to it. Set the opacity value toLayers() 1.0f
and the visibility totrue
.Use UrbanObservatory_NYC_TransitFrequency for layer_1.
Use dark colors for code blocks Copy Add another raster tile layer.
Use New_York_Industrial for layer_2.
Use dark colors for code blocks Copy Add one more raster tile layer and set the visibility to
true
.Use NewYorkCity_PopDensity for layer_3.
Use dark colors for code blocks Copy To add a 3D object scene layer, use the class name UArcGIS3DModelLayer.
Use New York, USA Buildings for buildingLayer.
Use dark colors for code blocks Copy
Save and you have successfully configured a scene using the API.
You can change the opacity and visibility of added layers (either during runtime or with presets), delete and reorder layers.
To remove a layer:
To change the opacity of a layer: