Position graphics relative to a surface using different surface placement modes.
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).
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.
GraphicsOverlayfor each placement mode, setting
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.
- Add graphics to the graphics overlay,
- Add each graphics overlay to the scene view by calling
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.
This sample uses an elevation service to add elevation/terrain to the scene. Graphics are positioned relative to that surface for the
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.
3D, absolute, altitude, draped, elevation, floating, relative, scenes, sea level, surface placement
<?xml version="1.0" encoding="utf-8" ?> <ContentPage x:Class="ArcGISRuntime.Samples.SurfacePlacements.SurfacePlacements" xmlns="http://xamarin.com/schemas/2014/forms" xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" xmlns:esriUI="clr-namespace:Esri.ArcGISRuntime.Xamarin.Forms;assembly=Esri.ArcGISRuntime.Xamarin.Forms"> <Grid> <Grid> <Grid.RowDefinitions> <RowDefinition Height="*" /> <RowDefinition Height="auto" /> <RowDefinition Height="auto" /> <RowDefinition Height="auto" /> <RowDefinition Height="auto" /> </Grid.RowDefinitions> <esriUI:SceneView x:Name="MySceneView" Grid.Row="0" /> <Button x:Name="BillboardedButton" Grid.Row="1" Clicked="BillboardedClicked" IsEnabled="False" Text="Draped Billboarded" /> <Button x:Name="FlatButton" Grid.Row="2" Clicked="FlatClicked" Text="Draped Flat" /> <Slider x:Name="ZSlider" Grid.Row="3" Margin="5" Maximum="140" MaximumTrackColor="CadetBlue" Minimum="0" MinimumTrackColor="CadetBlue" ValueChanged="ZSlider_ValueChanged" Value="70" /> <Label x:Name="ValueLabel" Grid.Row="4" Margin="5,0,5,0" Text="Z Value: 70 meters" /> </Grid> </Grid> </ContentPage>