I have used Interpolate shape tool in 3D Analyst (ArcGIS 9.2) in order to obtain Z-values of each segment along the stream lines.

As input features I use Riverstream.shp file and as raster surface the DEM. With right click on interpolated riverstream.shp after opening the attribute table, I created new column for X and Y coordinates. With right click on each column(for X & Y) using Calculate geometry I obtained X,Y values.

I need also to obtain elevation values (Z-values ) for stream segment as well as length of each segment in meters (with Calculate geometry there is not option to obtain Z values). I tried with Field calculator but without success.

Can anybody help me : How can I assign Z-values of stream segments.

  • try zonal statistics for your stream feature Apr 9, 2012 at 3:59

2 Answers 2


Assuming you have a polyline feature class with line segments you can use the following code in the field calculator.

In the pre-logic box

Dim pPolyline as IPolyline
set pPolyline = [Shape]

In the below text box you can use one of the three following lines depending on wich Z value you want.

From point


To point


Middle point

pPolyline.FromPoint.Z + (pPolyline.ToPoint.Z - pPolyline.FromPoint.Z) / 2

If like Tomek is saying you have a point feature class, you can simply use 'Add XY Coordinates' from the arctoolbox and it will create the X, Y and Z fields.


You do not realy say what kind of feature class you have. Assuming that your POINTS are already PointsM(Z) and you want to calculate Z's in to attributes table, there are few ways of doing this in 9.3. Though I am not sure whether you use 9.3 or 9.2. There are differences. Read this ESRI forum post. It should give you an answer. Otherwise you may want to use ET Geowizard toolbox. For up to 100 features in class it is for free.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.