Feature layer extrusion

View inMAUIUWPWPFWinUIView on GitHub

Extrude features based on their attributes.

Image of feature layer extrusion

Use case

Extrusion is the process of stretching a flat, 2D shape vertically to create a 3D object in a scene. For example, you can extrude building polygons by a height value to create three-dimensional building shapes.

How to use the sample

Press the button to switch between using population density and total population for extrusion. Higher extrusion directly corresponds to higher attribute values.

How it works

  1. Create a ServiceFeatureTable from a URL.
  2. Create a feature layer from the service feature table.
    • Make sure to set the rendering mode to dynamic.
  3. Apply a SimpleRenderer to the feature layer.
  4. Set ExtrusionMode of render, renderer.SceneProperties.ExtrusionMode = SceneProperties.ExtrusionMode.BaseHeight.
  5. Set extrusion expression of renderer, renderer.SceneProperties.ExtrusionExpression = "[POP2007]/ 10".

Relevant API

  • ExtrusionExpression
  • ExtrusionMode
  • FeatureLayer
  • FeatureLayer
  • SceneProperties
  • ServiceFeatureTable
  • SimpleRenderer

Tags

3D, extrude, extrusion, extrusion expression, height, renderer, scene

Sample Code

FeatureLayerExtrusion.xamlFeatureLayerExtrusion.xamlFeatureLayerExtrusion.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
<UserControl
    x:Class="ArcGIS.UWP.Samples.FeatureLayerExtrusion.FeatureLayerExtrusion"
    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 Style="{StaticResource BorderStyle}">
            <StackPanel>
                <Button x:Name="ToggleButton"
                        Click="Button_ToggleExtrusionData_Click"
                        HorizontalAlignment="Stretch"
                        Content="Show population density" />
            </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.