ArcGIS Pro 3.7 API Reference Guide
ArcGIS.Desktop.Mapping Namespace / TerrainLayer Class / InterpolateShape Method / InterpolateShape(Geometry,SurfaceInterpolationMethod,Double,Double) Method
The geometry to be interpolated. It must be a point, multipoint, polyline or polygon.
The method of interpolation. The default method of interpolation for Terrain layers is SurfaceInterpolationMethod.Linear.
A densification parameter. If specified, the multipart will be densified by the value prior to interpolating heights from the surface.
The z-tolerance or window-size resolution of the terrain pyramid level that will be used. Use 0 as a default.
Example

In This Topic
    InterpolateShape(Geometry,SurfaceInterpolationMethod,Double,Double) Method
    In This Topic
    Interpolates Z values for a geometric shape from the surface layer. This method requires a 3D Analyst license. This method must be called on the MCT. Use QueuedTask.Run.
    Syntax

    Parameters

    geometry
    The geometry to be interpolated. It must be a point, multipoint, polyline or polygon.
    interpolationMethod
    The method of interpolation. The default method of interpolation for Terrain layers is SurfaceInterpolationMethod.Linear.
    stepSize
    A densification parameter. If specified, the multipart will be densified by the value prior to interpolating heights from the surface.
    pyramidResolution
    The z-tolerance or window-size resolution of the terrain pyramid level that will be used. Use 0 as a default.

    Return Value

    A ArcGIS.Core.Geometry.Geometry with surface elevation z values.
    Exceptions
    ExceptionDescription
    geometry cannot be null.
    The set of parameters is invalid for this surface. See CanInterpolateShape.
    pyramidResolution must be 0 or larger.
    An exception occurred within the InterpolateShape calculation.
    This method or property must be called within the lambda passed to QueuedTask.Run.
    A 3D Analyst license is required.
    Remarks
    Portions of the input not falling within the interpolation zone of the surface will be clipped.

    Input polylines and polygons are densified by the stepSize. This takes place before interpolating heights from the surface. The densification ensures no two vertices are spaced more than stepSize apart.

    When using natural neighbors interpolation, consider specifying a sampling distance that's equal to or above half of the average point spacing of the data points in the surface.

    InterpolateShape will handle differences in spatial reference between the input shape and the surface. It will project (a copy of) the input geometry to match the surface for the sake of interpolation. It will then re-project the output geometry so it's the same as the input shape.

    Example
    Interpolate Shape
    {
      // Note: Needs QueuedTask to run
      // Note: Needs 3d Analyst license to run
      {
        ArcGIS.Core.Geometry.Geometry output = null;
        // interpolate z values for a geometry
        if (terrainLayer.CanInterpolateShape(polyline))
          output = terrainLayer.InterpolateShape(polyline, SurfaceInterpolationMethod.NaturalNeighbor);
    
        if (output != null)
        {
          // process the output
        }
    
        // densify the shape before interpolating
        if (terrainLayer.CanInterpolateShape(polygon))
          output = terrainLayer.InterpolateShape(polygon, SurfaceInterpolationMethod.Linear, 0.01, 0);
    
        if (output != null)
        {
          // process the output
        }
      }
    }
    Requirements

    Target Platforms: Windows 11 Home, Pro, Enterprise (64 bit)

    ArcGIS Pro version: 3.7 or higher.
    See Also