AnsweredAssumed Answered

Z Value

Question asked by BSUIRNIL on Feb 23, 2018

I have a stand alone application, I use axSceneControl for visualization.
The displayed layer has a base surface with Z factor (Factor to convert layer elevation values to scene unit) 0.001.

I'm trying to display a marker on the 3D Scene with the coordinates of the mouse using the code

Z = 0;

I get the Z coordinate using the ISurface of my IRasterLayer.


ISurface GetSurfaceFromLayer(IRasterLayer rasterLayer)
    ILayerExtensions layerExtensions = (ILayerExtensions) rasterLayer;
    ISurface ret = null;
    for (int i = 0; i < layerExtensions.ExtensionCount; i++)
        var types = layerExtensions.Extension[i].GetType();
        if (layerExtensions.Extension[i] is I3DProperties)
            I3DProperties ddDProperties = layerExtensions.Extension[i] as I3DProperties;
            if (ddDProperties.BaseOption == esriBaseOption.esriBaseSurface)
                //ddDProperties.ZFactor = 0.001
                ret = (ISurface) ddDProperties.BaseSurface;
                return ret;



double ZFactor = 1000;
Z = surface.GetElevation (pt) .Value / ZFactor;
The resulting Z value does not match the surface being drawn, sometimes the marker is displayed higher sometimes lower.


How to correctly determine the Z coordinate of axSceneControl for a point on the surface of a layer?