Surface placement

View inMAUIUWPWPFWinUIView on GitHub

Position graphics relative to a surface using different surface placement modes.

Image of surface placement

Use case

Depending on the use case, data might be displayed at an absolute height (e.g. flight data recorded with altitude information), at a relative height to the terrain (e.g. transmission lines positioned relative to the ground), at a relative height to objects in the scene (e.g. extruded polygons, integrated mesh scene layer), or draped directly onto the terrain (e.g. location markers, area boundaries).

How to use the sample

The application loads a scene showing four points that use individual surface placement modes (Absolute, Relative, Relative to Scene, and either Draped Billboarded or Draped Flat). Use the toggle to change the draped mode and the slider to dynamically adjust the Z value of the graphics. Explore the scene by zooming in/out and by panning around to observe the effects of the surface placement rules.

How it works

  1. Create a GraphicsOverlay for each placement mode, setting SceneProperties.SurfacePlacement:
    • Absolute, position graphic using only its Z value.
    • Relative, position graphic using its Z value plus the elevation of the surface.
    • DrapedBillboarded, position graphic upright on the surface and always facing the camera, not using its z value.
    • DrapedFlat, position graphic flat on the surface, not using its z value.
    • RelativeToScene, position graphic using its Z value plus the altitude values of the scene.
  2. Add graphics to the graphics overlay, GraphicsOverlayGraphics.Add(Graphic).
  3. Add each graphics overlay to the scene view by calling SceneView.GraphicsOverlays.Add(overlay).

Relevant API

  • Graphic
  • GraphicsOverlay
  • SceneProperties.SurfacePlacement
  • SceneProperties
  • Surface

About the data

The scene launches with a view of Brest, France. Four points are shown hovering with positions defined by each of the different surface placement modes.

Additional information

This sample uses an elevation service to add elevation/terrain to the scene. Graphics are positioned relative to that surface for the DrapedBillboarded, DrapedFlat, and Relative surface placement modes. It also uses a scene layer containing 3D models of buildings. Graphics are positioned relative to that scene layer for the RelativeToScene surface placement mode.

Tags

3D, absolute, altitude, draped, elevation, floating, relative, scenes, sea level, surface placement

Sample Code

SurfacePlacements.xamlSurfacePlacements.xamlSurfacePlacements.xaml.cs
Use dark colors for code blocksCopy
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
<UserControl
    x:Class="ArcGIS.UWP.Samples.SurfacePlacements.SurfacePlacements"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:esriUI="using:Esri.ArcGISRuntime.UI.Controls">
    <Grid>
        <esriUI:SceneView x:Name="MySceneView" />
        <Border Width="200" Style="{StaticResource BorderStyle}">
            <StackPanel>
                <RadioButton
                    x:Name="BillboardButton"
                    Content="Draped billboarded"
                    IsChecked="True" />
                <RadioButton x:Name="FlatButton" Content="Draped flat" />
                <TextBlock Margin="5">
                    <Run Text="Z Value:" />
                    <Run Text="{Binding ElementName=ZSlider, Path=Value}" />
                    <Run Text="meters" />
                </TextBlock>
                <Slider
                    x:Name="ZSlider"
                    Height="150"
                    Maximum="140"
                    Minimum="0"
                    Orientation="Vertical"
                    ValueChanged="ZValueChanged"
                    Value="70" />
            </StackPanel>
        </Border>
    </Grid>
</UserControl>

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