ArcObjects Library Reference (Geometry)  

IPoint.Z Property

The Z attribute.

[Visual Basic .NET]
Public Property Z As Double
[C#]
public double Z {get; set;}
[C++]
HRESULT get_Z(
  double* Z
);
[C++]
HRESULT put_Z(
  double Z
);
[C++]

Parameters

Z [out, retval]   Z is a parameter of type double Z   Z is a parameter of type double

Product Availability

Available with ArcGIS Engine, ArcGIS Desktop, and ArcGIS Server.

Description

Returns or Sets the Z attribute on the Point.  Although the Z attribute refers to the 3-Dimensional depth of the point, the point still spatially exists in only 2-Dimensions with a Z attribute.  Further, the point must be ZAware to make use of the Z attribute.

[C#]

    // The following example shows how to set the x,y,z,m properties
    // for a point. Note that you need to tell the point to be
    // M- and Z-aware.
    public void DisplayCoordinates()
    {
        IPoint point = new PointClass();
        point.PutCoords(100, 100);
        IMAware mAware = point as IMAware;
        mAware.MAware = true;
        IZAware zAware = point as IZAware;
        zAware.ZAware = true;
        point.Z = 50;
        point.M = 10;
        System.Windows.Forms.MessageBox.Show(point.X + "," + point.Y + "," + point.Z + "," + point.M);
    }

See Also

IPoint Interface | IPoint.X Property | IPoint.Y Property | IPoint.M Property | IPoint.Z Property | IZAware Interface | IZCollection Interface | IZ Interface

.NET Snippets

Toggle Between Surface and Global Navigation Mode | Set Z Value on Point | Zoom to 3D Bookmark |