I'm trying to figure out how to get the elevation at a given MapPoint from a surface. I'm getting all of my MapPoint values from a MapTool click event. The Z value is not set at this point. I have a TIN layer added to my map but can't find how to get the elevation from it.
Joseph (and Ted),
In Pro 1.3 you can now use something like a sketch point tool and examine the returned geometry for the Z value.
The Z will be taken from the current elevation environment as set in the elevation group on the Edit tab. If required you can programmatically set this environment (set z modes and select a surface) but at this time you cant add an elevation source to a surface through code.
Here's a sample point sketch tool:
class pointSketchZ : MapTool
IsSketchTool = true;
SketchType = SketchGeometryType.Point;
SketchOutputMode = SketchOutputMode.Map;
UseSnapping = true;
protected override Task<bool> OnSketchCompleteAsync(Geometry geometry)
return QueuedTask.Run(() =>
var mp = geometry as MapPoint;
MessageBox.Show("X: " + mp.X + "\n" + "Y: " + mp.Y + "\n" + "Z: " + mp.Z);
In a future release you'll be able to query a surface with an xy to return a Z value.
In 2D maps there is no default elevation source set for the ground surface. With Z mode off, you'll get a value of 0 for the returned Z value. You can turn Z mode on and set a constant elevation or select a surface if you have defined an elevation source for a surface (ground or a new one).
In 3D scenes (local and globe) the world elevation service is set as an elevation source for the ground surface. If Z mode is off in these views, a Z will still be returned. You can still set a constant or choose surfaces.
To get the world elevation service in 2D views, you can add it to the ground surface (or create a new surface for it) through the map elevation surface properties. In that dialog when you click 'Add elevation source' search All Portal (in the tree on the left) for "terrain3d". This is also where you would set any local tins or grids to a surface. You can now select that surface in the edit tab to get Z values from.
Ah ok, I was getting ahead of myself.
In 3D views, the view (what you see is what you get) is the current surface, so you cant set additional surfaces.
For the bulk elevation lookup, I would use the 'add surface information' GP tool that Joseph mentioned earlier.