English

How To: Extract point elevation values from a DEM

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