# How do I get the upstream distance to all points in a DEM from a single downstream point?

I want to get the upstream distance to all points in a DEM from a single downstream point. The goal is to create a "downstream distance to a point grid". This then would allow me to create "distance" contours upstream from a point in the watershed.

I tried using the Raster Calculator with this equation:

``````Outras = Con("Fdr" == 1,16,Con("Fdr" == 2,32,Con("Fdr" == 4,64,Con("Fdr" == 8,128,Con("Fdr" == 16,1,Con("Fdr" == 16,1,Con("Fdr" == 32,2,Con("Fdr" == 64,4,Con("Fdr" == 128,8)))))))))
``````

This "reverses" the flow direction in the `Fdr` grid, but doesn't really work.

Any suggestions?

-
Incidentally, there are many ways to shorten your raster calculator expression, such as Con("Fdr" >= 16, "Fdr"/16, "Fdr"*16). But you're right; that's no good as input to any flow-based calculation. Are you using a sufficiently recent version of SA that supports `PathDistance`? – whuber Dec 16 '11 at 21:49
Can't you use the "Flow Length" geoprocessing tool in hydrological toolset to do this? – dmahr Dec 16 '11 at 22:20
@dmahr is correct: the DOWNSTREAM option specifically does this: "Calculates the downslope distance along the flow path, from each cell to a sink or outlet on the edge of the raster." – whuber Dec 12 '12 at 18:19

Flow length uses the precalculated flow direction raster to calculate the distance traveled in the flow direction raster to the most upstream or downstream cell in the raster (depending on the `direction_measurement` parameter. In this case, you should use the `DOWNSTREAM` option for this parameter.