Skip To Content ArcGIS for Developers Sign In Dashboard

Add features and graphics to a scene view

In ArcGIS Runtime SDKs, geoelements are used to represent real-world objects on a map or scene. The two types of geoelement are features and graphics, each of which has a geometry representing its shape and location on the surface of the Earth. They can also contain a set of attributes that further describe the represented object.

You can add graphics to graphics overlays and add graphics overlays to either a map view or scene view. The way you add features and graphics to scenes follows the same steps required to add them to maps, with these additional considerations:

When to use features or graphics

Features and graphics are similar to one another in that they both have a geometry and may store a set of attributes. Both features and graphics can be:

Features and graphics, however, are designed for different uses. While both can represent geographic elements, there are factors that may make one of them a better choice for specific tasks. See Features and graphics for more information.

Add features to a scene view when you want to:

  • Display data with a common attribute schema (for example, census data)
  • Display geographical data of a common geometry type (point, line, or polygon)
  • Persist or store the data beyond the current app session

Add graphics to a scene view when:

  • You want to display temporary data, such as fast-changing, fast-moving data (for example, a fleet of airliners, or voluminous data).
  • You want to display data that doesn't share a common geometry type (such as point, line, or polygon) and doesn't share a common set of attribute fields
  • The data is required only for the current app session

Add features to a scene view

Feature layers can contain any number of features of a single geometry type (point, polyline or polygon). Adding features to a scenes is the same as adding features to a map:

  1. Add features to a feature layer
  2. If you want to include features' attributes (to run queries, for example), make sure to use LOAD_ALL if building your feature layer from a service feature table
  3. Add the feature layer to the scene's operational layers

// add feature layer(s)
final FeatureLayer featureLayer = new FeatureLayer(serviceFeatureTable);
// load all attributes in the service feature table
final QueryParameters queryParams = new QueryParameters();
queryParams.setWhereClause("1=1");
serviceFeatureTable.queryFeaturesAsync(queryParams, ServiceFeatureTable.QueryFeatureFields.LOAD_ALL);
// add the feature layer to the scene
scene.getOperationalLayers().add(featureLayer);

Add graphics to a scene view

Adding graphics to scenes is the same as adding graphics to maps:

  1. Add graphics to a graphics overlay
  2. Set the graphic overlays surface placement, if you prefer a surface placement other than the default DRAPED
  3. Add the graphics overlay to the scene view's graphic overlays
Note:

Any graphic you add to a scene view must be constructed from a geometry with a spatial reference.

In 3D, you can add graphics such as points, polylines, polygons, and 3D marker symbols, all into the same graphics overlay or into multiple graphics overlays.

For additional details on adding graphic overlays to a map or scene, see Add graphic overlays to your app. For details on adding graphics to a graphics overlay, see Add graphics and text to graphics overlays.

// add graphics overlay(s)
GraphicsOverlay graphicsOverlay = new GraphicsOverlay();
graphicsOverlay.getSceneProperties().setSurfacePlacement(LayerSceneProperties.SurfacePlacement.ABSOLUTE);
sceneView.getGraphicsOverlays().add(graphicsOverlay);

Surface placement modes

For both feature layers and graphics overlays, you can specify a surface placement mode or use the default mode of DRAPED. These modes control how the z-value of your geometry is used when features and graphics are drawn.

  • DRAPED—(default) Features and graphics are drawn on the surface. The z-value has no effect.
  • ABSOLUTE—Features and graphics are drawn at a height using the z-value referenced from above the globe skin (sea level).
  • RELATIVE—Features and graphics are drawn at a height using the z-value referenced from above the surface layer.

The following code shows the same data loaded into three different feature layers with different surface placement modes.

// create overlays with elevation modes

FeatureLayer drapedFeatureLayer = featureLayer.copy();
// feature layers are set to SurfacePlacement.DRAPED by default, though it can be set explicitly as below:
drapedFeatureLayer.getSceneProperties().setSurfacePlacement(LayerSceneProperties.SurfacePlacement.DRAPED);
scene.getOperationalLayers().add(drapedFeatureLayer);

FeatureLayer relativeFeatureLayer = featureLayer.copy();
drapedFeatureLayer.getSceneProperties().setSurfacePlacement(LayerSceneProperties.SurfacePlacement.RELATIVE);
scene.getOperationalLayers().add(relativeFeatureLayer);

FeatureLayer absoluteFeatureLayer = featureLayer.copy();
absoluteFeatureLayer.getSceneProperties()
    .setSurfacePlacement(LayerSceneProperties.SurfacePlacement.ABSOLUTE);
scene.getOperationalLayers().add(absoluteFeatureLayer);

The following code shows three points drawn in graphics overlays in the three different surface placement modes. The red graphic is draped on the surface, the blue graphic is drawn in absolute mode, and the green in relative mode

// create overlays with elevation modes
GraphicsOverlay drapedOverlay = new GraphicsOverlay();
drapedOverlay.getSceneProperties().setSurfacePlacement(SurfacePlacement.DRAPED);
sceneView.getGraphicsOverlays().add(drapedOverlay);
GraphicsOverlay relativeOverlay = new GraphicsOverlay();
relativeOverlay.getSceneProperties().setSurfacePlacement(SurfacePlacement.RELATIVE);
sceneView.getGraphicsOverlays().add(relativeOverlay);
GraphicsOverlay absoluteOverlay = new GraphicsOverlay();
absoluteOverlay.getSceneProperties().setSurfacePlacement(SurfacePlacement.ABSOLUTE);
sceneView.getGraphicsOverlays().add(absoluteOverlay);


// create a text symbol for each elevation mode
TextSymbol drapedText = new TextSymbol(10, "DRAPED", 0xFFFFFFFF, HorizontalAlignment.LEFT,
  VerticalAlignment.MIDDLE);
TextSymbol relativeText = new TextSymbol(10, "RELATIVE", 0xFFFFFFFF, HorizontalAlignment.LEFT,
  VerticalAlignment.MIDDLE);
TextSymbol absoluteText = new TextSymbol(10, "ABSOLUTE", 0xFFFFFFFF, HorizontalAlignment.LEFT,
  VerticalAlignment.MIDDLE);


// create point for graphic location
Point point = new Point(-4.04, 53.06, 1000, sceneView.getSpatialReference());
SimpleMarkerSymbol redSymbol = new SimpleMarkerSymbol(SimpleMarkerSymbol.Style.CIRCLE, 0xFFFF0000, 10);
SimpleMarkerSymbol greenSymbol = new SimpleMarkerSymbol(SimpleMarkerSymbol.Style.CIRCLE, 0xFF00FF00, 10);
SimpleMarkerSymbol blueSymbol = new SimpleMarkerSymbol(SimpleMarkerSymbol.Style.CIRCLE, 0xFF0000FF, 10);


// add the point graphic and text graphic to the corresponding graphics
// overlay
drapedOverlay.getGraphics().add(new Graphic(point, redSymbol));
drapedOverlay.getGraphics().add(new Graphic(point, drapedText));


relativeOverlay.getGraphics().add(new Graphic(point, greenSymbol));
relativeOverlay.getGraphics().add(new Graphic(point, relativeText));


absoluteOverlay.getGraphics().add(new Graphic(point, blueSymbol));
absoluteOverlay.getGraphics().add(new Graphic(point, absoluteText));

Graphics rendered at different heights, despite all having the same z-value.

Graphics drawn with different surface placement options

3D rendering properties

When using renderers in 3D, you can set properties to define extrusion expressions for both features and graphics. For graphics you can also define a rotation expression. For more information and examples of using extrusion expressions with a renderer, see Extruding with a renderer in the Symbolize data topic.

Extrusion is the process of stretching a flat 2D shape vertically to create a 3D object. This provides a simple method to create three-dimensional symbology from two-dimensional features. For example, you can extrude building polygons by a height value to create realistic building shapes. You can also use extrusion to illustrate relative values in your data. The three basic geometry types-points, lines, and polygons-all support extrusion

Note:

Extrusion may not work with some types of multilayer symbols, such as hatch fills.

The following image shows a graphics overlay of US counties extruded based on a population attribute.

County polygons extruded on population

Create 3D symbols

While you can use the same 2D symbols available for symbolizing graphics in a map view, ArcGIS Runtime provides some specialized symbols for displaying graphics in a scene view. You can display points and lines as 3D shapes or use models to realistically represent real-world objects (such as vehicles).

ArcGIS Runtime provides the following types of 3D-specific symbols. See 3D-specific symbols for more information.

  • Simple marker scene symbols—Cone, Cube, Cylinder, Diamond, Sphere, and Tetrahedron
  • Stroke symbol layer 3D line styles—Strip, Tube
  • Model 3D symbols—Displays a 3D model file

3D symbols