SurfaceZsResultStatus Enumeration
Defines the status types resulting from calling Map.GetZsFromSurfaceAsync(). See
SurfaceZsResult
Get Elevation profile from the default ground surface
// find the elevation profile for a polyline / set of polylines
var result = await MapView.Active.Map.GetElevationProfileFromSurfaceAsync([lineGeom]);
if (result.Status == SurfaceZsResultStatus.Ok)
{
var polylineZ = result.Polyline;
// process the polylineZ
}
// find the elevation profile for a set of points
result = await MapView.Active.Map.GetElevationProfileFromSurfaceAsync(pts);
if (result.Status == SurfaceZsResultStatus.Ok)
{
var polylineZ = result.Polyline;
// process the polylineZ
}
Get Elevation profile from a specific surface
// find the elevation profile for a polyline / set of polylines
var eleLayer = MapView.Active.Map.GetElevationSurfaceLayers().FirstOrDefault(l => l.Name == "TIN");
var zResult = await MapView.Active.Map.GetElevationProfileFromSurfaceAsync([lineGeom], eleLayer);
if (zResult.Status == SurfaceZsResultStatus.Ok)
{
var polylineZ = zResult.Polyline;
// process the polylineZ
}
// find the elevation profile for a set of points
zResult = await MapView.Active.Map.GetElevationProfileFromSurfaceAsync(pts, eleLayer);
if (zResult.Status == SurfaceZsResultStatus.Ok)
{
var polylineZ = zResult.Polyline;
// process the polylineZ
}
Interpolate a line between two points and calculate the elevation profile
int numPoints = 20;
// use the default ground elevation surface
var result = await MapView.Active.Map.GetElevationProfileFromSurfaceAsync(startPt, endPt, numPoints);
if (result.Status == SurfaceZsResultStatus.Ok)
{
var polylineZ = result.Polyline;
// process the polylineZ
}
// use a specific elevation surface
var eleLayer = MapView.Active.Map.GetElevationSurfaceLayers().FirstOrDefault(l => l.Name == "TIN");
result = await MapView.Active.Map.GetElevationProfileFromSurfaceAsync(startPt, endPt, numPoints, eleLayer);
if (result.Status == SurfaceZsResultStatus.Ok)
{
var polylineZ = result.Polyline;
// process the polylineZ
}
Get Z values from a TIN Layer
var tinLayer = MapView.Active.Map.GetLayersAsFlattenedList().OfType<TinLayer>().FirstOrDefault();
await QueuedTask.Run(() =>
{
if (tinLayer.CanGetZs())
{
// get z value for a mapPoint
var zResult = tinLayer.GetZs(mapPoint);
if (zResult.Status == SurfaceZsResultStatus.Ok)
{
// cast to a mapPoint
var mapPointZ = zResult.Geometry as MapPoint;
var z = mapPointZ.Z;
}
// get z values for a polyline
zResult = tinLayer.GetZs(polyline);
if (zResult.Status == SurfaceZsResultStatus.Ok)
{
// cast to a Polyline
var polylineZ = zResult.Geometry as Polyline;
}
}
});
System.Object
System.ValueType
System.Enum
ArcGIS.Desktop.Mapping.SurfaceZsResultStatus
Target Platforms: Windows 11, Windows 10
ArcGIS Pro version: 3 or higher.