GetZsFromSurfaceAsync(Geometry) Method
Obtains a geometry that is similar to the given input geometry, where all Z values are populated from the default Ground Surface Layer.
Parameters
- geometry
- the input geometry
Return Value
A result that contains a status, plus an output geometry only if the status is favorable.
Get Z values from the default ground surface
var mapPoint = await QueuedTask.Run<MapPoint>(() =>
{
MapPoint mapCentergeometry = MapView.Active.Map.CalculateFullExtent().Center;
return mapCentergeometry;
});
//Pass any Geometry type to GetZsFromSurfaceAsync
var surfaceZResult = await MapView.Active.Map.GetZsFromSurfaceAsync(mapPoint);
if (surfaceZResult.Status == SurfaceZsResultStatus.Ok)
{
// cast to a mapPoint
var mapPointZ = surfaceZResult.Geometry as MapPoint;
var z = mapPointZ.Z;
}
Get Z values from a specific surface
var eleLayer = MapView.Active.Map.GetElevationSurfaceLayers().FirstOrDefault(l => l.Name == "TIN");
//Pass any Geometry type to GetZsFromSurfaceAsync
var zResult = await MapView.Active.Map.GetZsFromSurfaceAsync(polyline, eleLayer);
if (zResult.Status == SurfaceZsResultStatus.Ok)
{
var polylineZ = zResult.Geometry as Polyline;
// process the polylineZ
}
Target Platforms: Windows 11, Windows 10
ArcGIS Pro version: 3 or higher.