How to extrude features in globe


Summary 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. The three basic geometry types—points, lines and polygons—all support extrusion. This document explains the process of extruding a feature layer using different extrusion options in globe.

Development licensing Deployment licensing
ArcView: 3D Analyst ArcView: 3D Analyst
ArcEditor: 3D Analyst ArcEditor: 3D Analyst
ArcInfo: 3D Analyst ArcInfo: 3D Analyst

When a feature layer is extruded, this change has to be reflected in the globe height properties of the layer. So, the first step is to get a handle to the present globe height properties of the layer. The following code segment illustrates the steps to do this. This code makes use of an ESRI.ArcGIS.GlobeCore.IGlobe globe, an ESRI.ArcGIS.Carto.IFeatureLayer featureLayer, and a string sExtrusionExpression that should be defined earlier in the code.

[C#]
ESRI.ArcGIS.GlobeCore.IGlobeDisplayLayers globeDisplayLayers =
  globe.GlobeDisplay as ESRI.ArcGIS.GlobeCore.IGlobeDisplayLayers;
ESRI.ArcGIS.GlobeCore.IGlobeLayerProperties globeLayerProperties =
  globeDisplayLayers.FindGlobeProperties(featureLayer);
ESRI.ArcGIS.GlobeCore.IGlobeHeightProperties2 glbHeightProps =
  globeLayerProperties.HeightProperties as IGlobeHeightProperties2;
There are five types of extrusion that can be used to apply a height specified in the extrusion expression string (IGlobeHeightProperties::ExtrusionExpressionString) to a feature layer using the enumeration 'esriExtrusionType'
 
  1. esriExtrusionNone - Use this option to apply no extrusion to features in feature layer. In this case the features will have a height of 0.
  2. esriExtrusionMinZ - Use this option to add height to the minimum Z value of each feature in the feature layer. In Figure 1, the extrusion height is applied to the vertex with minimum Z (represented by the green dot). In case of 2D features, the minimum Z value is always 0.
 
Figure 1: esriExtrusionMinZ
 
  1. esriExtrusionMaxZ - Use this option to add height to the maximum Z value of each feature in the feature layer. In Figure 2, the extrusion height is applied to the vertex with maximum Z (represented by the green dot).In case of 2D features, the maximum Z value is always 0.
 
Figure 2: esriExtrusionMaxZ
 
  1. esriExtrusionBase - Use this option to add height to each feature. The Z value of each vertex of the features is calculated using the base elevation defining the globe surface. In Figure 3, the extrusion height is applied to the both vertices (represented by the green dot) using the Z defined by the globe surface.
 
Figure 3: esriExtrusionBase
 
  1. esriExtrusionAbsolute - Use this option to add an absolute height to  each feature in the feature layer. In Figure 4, the extrusion height is applied to the vertices such that the feature is extruded to an absolute height (represented by the green arrow).
 
Figure 4: esriExtrusionAbsolute
 
The following code segments illustrates applying the extrusion properties.

[C#]
glbHeightProps.ExtrusionType = esriExtrusionType.esriExtrusionMinZ;
glbHeightProps.ExtrusionExpressionString = sExtrusionExpression;
glbHeightProps.BottomlessExtrusions = true;
After defining the extrusion properties, we need to apply the Globe Height properties to feature layer properties using the IGlobeLayerProperties::ValidateType() method.

[C#]
globeLayerProperties.ValidateType();
Applying extrusion invalidates the current scale (level of detail) of the feature layer and resets it to -1. The appropriate scale (LOD) of the extruded feature layer is determined using the IGlobeLayerProperties::EstimateFeatureLODRange() method and then applied to the layer by setting the IGlobeLayerProperties::MaxFeatureLevelOfDetail property.

[C#]
if (globeLayerProperties.MaxFeatureLevelOfDetail ==  - 1)
{
  int minLOD;
  int defaultLOD;
  int maxLOD;
  int minminLOD;
  int maxmaxLOD;
  globeLayerProperties.EstimateFeatureLODRange(out minLOD, out defaultLOD, out
    maxLOD, out minminLOD, out maxmaxLOD);
  globeLayerProperties.MaxFeatureLevelOfDetail = defaultLOD;
}
To reflect the changes made to the layer display and height properties, the layer is refreshed.
[C#]
globeDisplayLayers.RefreshLayer(featureLayer as ILayer);