[GIS] Get rivers from a DEM raster

elevationrrasterrivers

I am new to spatial analysis and even newer to hydrology. I have a 30arc DEM elevation raster and I was wondering if I can use it as an input to get the approximate presence of rivers in a geographically determined zone. I know I can use rivers shapefile to do this, but since I am working with cells as my unit observation, it is cleaner get the data from the DEM raster.

raster package in R seems appropriate to this. Nonetheless, it only calculates hill, slope and roughness.

Best Answer

#You can run GRASS 6.4 commands in R using the spgrass6 package    
require(spgrass6)

# connect to existing GRASS layer location using Mac OS X
loc <- initGRASS("/Applications/GRASS-6.4.app/Contents/MacOS",
                 gisDbase="/Users/junf/Documents/WatershedModel/MyDataFolder", 
                 location="colonia", mapset="flood",override=T,
                 SG="fil_srtm30_fill_dist2out")

# use Grass 6.4 r.watershed to delineate streams
execGRASS(cmd='r.watershed', flags='overwrite', 
    parameters =  list(elevation='val_srtm30@flood', threshold='2000', 
          drainage='wat30_drain', accumulation='wat30_accu', basin='wat30__basin', 
          stream='wat30__stream', memory='2000'))
# thin streams to make them 1-pixel wide
execGRASS('r.thin', parameters = list(input='wat30__stream', output='wat30__stream')) 
# convert stream raster to vector
execGRASS('r.to.vect', parameters = list(input='wat30__stream', output='v_stream_wat30'))

#The final output stream vector is v_stream_wat30 which remains GRASS format
Related Question