Select to view content in your preferred language

Intersection a stream with a DEM

857
2
11-22-2010 06:33 AM
JacquesTardie
Emerging Contributor
I'm not sure I'm approaching this correctly as I've found nothing so far Googling.

Anyways, I'm trying to determine the slope of a stream (actually, a series of polyline segments making up a stream).  I've gone the ArcHydro route, but the results I'm getting from the assign stream slope are relative, whereas if I used a DEM they might be a bit more static.

So, my question is, what's the best way to intersect a stream (or any series of polylines) with a DEM to give the stream XYZ attributes?

Thanks again,
Jacques
0 Kudos
2 Replies
ChrisSnyder
Honored Contributor
There are some different thoughts on the subject:

1. Get the elevations of just the Start and End nodes (FeatureVerticesToPoints_management tool and then ExtractValueToPoints_sa tool)
2. Get the elevations of all the vertices (FeatureVerticesToPoints_management tool and then ExtractValueToPoints_sa tool) - This is a bit more involved...
3. Rasterize the stream layer, derive a slope grid, and then use the ZonalStatistics tool (MEAN) to get the mean slope for each stream segment. AThis is probably the easiest, but again is the mean slope, not really THE slope.

You could also mix it up a bit and get the MIN and MAX elevations for each stream segment zone using the ZonalStatistics tool, and then derive slope similar to #1.
0 Kudos
JeffreyEvans
Frequent Contributor
I think that you are after the stream gradient. The gradient is defined as the ratio of drop per unit distance. This is just like the rise/run slope calculation but is ordered along the stream reach. The mean slope will not give you this. Being the dinosaur that I am I only have code to do this in Workstation ArcInfo but as William Huber pointed out, there is a legacy of threads that discuss this in the old knowledge base. Just in case you are willing to work in ArcInfo, I attached the AML code. The input is a line coverage with an attribute that defines the stream reach and a DEM.

/*   Program: GRADIENT.AML
/*   Purpose: Calculates the gradient of a line coverage based on elevation
/*===================================================================================
/*  Usage: GRADIENT <COVER> <GRID> <SUMITEM> <OUTITEM>
/*
/*  Arguments: COVER - Line cover to calculate gradient.
/*             GRID - Elevation grid.
/*             SUMITEM - INFO item in line cover to summarize gradients by.
/*             OUTITEM - Item in coverage INFO file to hold gradient value.
/*===================================================================================
/* Calls: MUST BE RUN FROM ARC (Calls ARCPLOT, GRID, and TABLES)
/*===================================================================================
/*      Jeffrey Evans - Senior Landscape Ecologist
/*       The Nature Conservancy, Central Science
/*       Laramie, WY
/*       jeffrey_evans@tnc.org
/*===================================================================================
&args cov grid item infoitem

&if [show PROGRAM] <> ARC &then
  &return &inform CAN ONLY BE RUN FROM ARC

&if [NULL %cov%] = .TRUE. &then
  &return &inform Usage: GRADIENT <COVER> <GRID> <SUMITEM> <OUTITEM>

&if [NULL %grid%] = .TRUE. &then
  &return &inform Usage: GRADIENT <COVER> <GRID> <SUMITEM> <OUTITEM>

&if [NULL %item%] = .TRUE. &then
  &return &inform Usage: GRADIENT <COVER> <GRID> <SUMITEM> <OUTITEM>

&if [NULL %infoitem%] = .TRUE. &then
  &return &inform Usage: GRADIENT <COVER> <GRID> <SUMITEM> <OUTITEM>

&if [iteminfo %cov%.aat -info %infoitem% -exists] = .TRUE. &then
  &return &inform Item [upcase %infoitem%] already exist!

&if [exists %grid% -grid] = .FALSE. &then
  &return &inform Grid [upcase %grid%] does not exist!

&if [iteminfo %cov%.aat -info %item% -exists] = .FALSE. &then
  &return &inform Item [upcase %item%] does not exist!

&if [exists %cov% -cover] = .FALSE. &then
  &return &inform Coverage [upcase %cov%] does not exist!

&if [exists %cov% -line] = .FALSE. &then
  &return &inform [upcase %cov%] does not appear to be a line coverage or lacks topology!

&s tmp1 [scratchname -prefix xx1]
&s tmp2 [scratchname -prefix xx2]
&s tmp3 [scratchname -prefix xx3]
&s tmp4 [scratchname -prefix xx4]

/*===================================================================================
&TYPE /& CREATING BASE FILES FOR GRADIENT CALCULATION /&
/*===================================================================================

NODEPOINT %cov% %tmp1%
BUILD %tmp1% point

/*===================================================================================
&TYPE /& GENERATING ELEVATION VALUES FOR EACH NODE /&
/*===================================================================================

additem %tmp1%.pat %tmp1%.pat %grid% 4 12 f 3
display 0
ARCPLOT
&messages &off
cursor ptcur declare %tmp1% points rw
cursor ptcur open
&echo &off
&do &while %:ptcur.aml$next%
  &s temp [show cellvalue %grid% [show select %tmp1% point 1 xy]]
  &if [type %temp%] = 1 &then
    &s :ptcur.%grid% -9999
  &else
    &s :ptcur.%grid% %temp%
  cursor ptcur next
&end
QUIT
&messages &on

/*===================================================================================
&TYPE /& RELATING LINE COVERAGE TO POINT SAMPLES /&
/*===================================================================================

PULLITEMS %cov%.aat %tmp2%
FNODE#
TNODE#
LENGTH
%item%
END

TABLES
ADDITEM %tmp2% RISE 4 6 F 3

SEL %tmp2%
RELATE ADD
R1
%tmp1%.PAT
INFO
FNODE#
%tmp1%#
ORDERED
RO
R2
%tmp1%.PAT
INFO
TNODE#
%tmp1%#
ORDERED
RO
[UNQUOTE ' ']

/*===================================================================================
&TYPE /& CALCULATING RISE FOR EACH ARC /&
/*===================================================================================

SEL %tmp2%
RESELECT R1//%grid% > R2//%grid%
CALCULATE RISE = R1//%grid% - R2//%grid%
NSELECT %tmp2%
CALCULATE RISE = R2//%grid% - R1//%grid%

/*===================================================================================
&TYPE /& SUMARIZING LENGTH AND RISE BY [upcase %item%] /&
/*===================================================================================

SEL %tmp2%
STATISTICS %item% %tmp3%
SUM LENGTH
SUM RISE
END

ADDITEM %tmp3% %infoitem% 4 6 F 3

/*===================================================================================
&TYPE /& CALCULATING GRADIENT /&
/*===================================================================================

SEL %tmp3%
CALCULATE %infoitem% = SUM-RISE / SUM-LENGTH * 100
QUIT

/*===================================================================================
&TYPE /& ADDING [upcase %infoitem%] TO [upcase %cov%] /&
/*===================================================================================

PULLITEMS %tmp3% %tmp3%
%item%
%infoitem%
END

JOINITEM %cov%.aat %tmp3% %cov%.aat %item%

/*===================================================================================
&TYPE /& CLEANING UP /&
/*===================================================================================

KILL %tmp1% all
KILLINFO (!%tmp2% %tmp3%!)
RELATE DROP
r1
r2
[UNQUOTE ' ']
0 Kudos