ArcGIS Pro 3.0 API Reference Guide
ArcGIS.Core.Geometry Namespace / GeometryEngine Class / CalculateNonSimpleZs Method
The polygon or polyline to calculate Z-values for.
The value to which NaN Z-values that could not be interpolated will be set.
Example

In This Topic
    CalculateNonSimpleZs Method (GeometryEngine)
    In This Topic
    Calculates Z attribute values for each non-simple (NaN) Z-value from existing simple (non-NaN) Z attributes on the specified geometry. The non-simple Z values are obtained by extrapolation/interpolation for polylines and interpolation for polygons.
    Syntax
    public Multipart CalculateNonSimpleZs( 
       Multipart multipart,
       double defaultZValue
    )
    Public Function CalculateNonSimpleZs( _
       ByVal multipart As Multipart, _
       ByVal defaultZValue As Double _
    ) As Multipart

    Parameters

    multipart
    The polygon or polyline to calculate Z-values for.
    defaultZValue
    The value to which NaN Z-values that could not be interpolated will be set.

    Return Value

    A geometry in which each coordinate has a simple (non-NaN) Z value.
    Exceptions
    ExceptionDescription
    Multipart is null or empty.
    This geometry is not Z-Aware.
    Example
    Interpolate Z values on a polyline
    List<Coordinate3D> coords2 = new List<Coordinate3D>()
    {
      new Coordinate3D(0, 0, 0),
      new Coordinate3D(0, 1000, double.NaN),
      new Coordinate3D(1000, 1000, 50),
      new Coordinate3D(1000, 1000, 76),
      new Coordinate3D(0, 1000, double.NaN),
      new Coordinate3D(0, 0, 0)
    };
    
    SpatialReference sr = SpatialReferences.WebMercator;
    
    Polyline polyline = PolylineBuilderEx.CreatePolyline(coords2, sr);
    
    // polyline.HasZ = true
    // polyline.Points[1].HasZ = true
    // polyline.Points[1].Z  = NaN   
    // polyline.Points[4].HasZ = true
    // polyline.Points[4].Z  = NaN   
    
    Polyline polylineNoNaNZs = GeometryEngine.Instance.CalculateNonSimpleZs(polyline, 0) as Polyline;
    
    // polylineNoNaNZs.Points[1].HasZ = true
    // polylineNoNaNZs.Points[1].Z = 25  (halfway between 0 and 50)
    // polylineNoNaNZs.Points[4].HasZ = true
    // polylineNoNaNZs.Points[4].Z = 38  (halfway between 76 and 0)
    Requirements

    Target Platforms: Windows 11, Windows 10, Windows 8.1

    See Also