HOW TO

Extract point elevation values from a DEM

Last Published: April 25, 2020

Summary

Point feature elevation values can be extracted from a spatially corresponding DEM using ARC Macro Language (AML).

Procedure



This sample aml extracts DEM z values for the specified point coverage.

Code:
/*POINTZVALUE.AML
/* This AML will extract DEM Z values for a specified point coverage.
&args cover item grid

/* Pass the AML the following parameters:
/* COVER - Name of the point coverage.
/* ITEM - Item to store the extract Z values.
/* GRID - Elevation grid to extract values from.

arcplot

/* Describe the point coverage to determine the
/* number of points to loop through.

&describe %cover%

/* Loop once for each point feature in the coverage.

&do i = 1 &to %dsc$points%

/* Select a point feature.
reselect %cover% point %cover%# = %i%

/* Extract the XY coordinate of the selected point.
&sv xy = [show select %cover% point 1 xy]

/* Using the XY coordinates, extract the Z value
/* from the raster.
&sv cellvalue = [show cellvalue %grid% %xy%]

/* Update the elevation item for the selected point.
calculate %cover% point %item% = %cellvalue%

/* Clear all selected features.
clearselect
&end

quit
&return

Article ID:000002525

Software:
  • Legacy Products

Receive notifications and find solutions for new or common issues

Get summarized answers and video solutions from our new AI chatbot.

Download the Esri Support App

Discover more on this topic

Get help from ArcGIS experts

Contact technical support

Download the Esri Support App

Go to download options