How to extract river geometries in GRASS GIS

  1. Find the EPSG ID of your GeoTIFF
  2. Create a new location using the EPSG ID from step 1
  3. r.in.gdal input=USGS_13_n33w107_20220721.tif output=dem
  4. Try g.proj -p
  5. Use https://projpicker.pythonanywhere.com/ to find the most local projection in meters
  6. Create another location in the most local SI projection found in step 5
  7. Reproject the dem raster from the 1st location
  8. Double-check your projection using g.proj -p
  9. Check the computational region; it’s very small
  10. Try r.proj help to see what it can do
  11. r.proj -g location=CE531Spring2023LatLong input=dem
  12. g.region -p $(r.proj location=CE531Spring2023LatLong input=dem -g)
  13. r.proj location=CE531Spring2023LatLong input=dem output=dem method=lanczos_f
  14. r.watershed elev=dem drain=drain
  15. r.accumulate direction=drain accumulation=accum
  16. Using the raster query tool, extract the accum values of both ends of the study reach (e.g., 6616759 and 6995234)
  17. Extract any accum cells between those two values using r.mapcalc
    1. r.mapcalc ex=“streams=if(accum>=6616759 && accum<=6995234, 1, null())”
  18. r.to.vect input=streams output=streams type=line
  19. Get the category of your stream line (e.g., 4)
  20. v.extract input=streams cat=4 output=final_stream
  21. In case, the directionality is reversed,
    1. v.edit map=final_stream tool=flip cat=4
  22. v.out.ascii input=final_stream format=standard output=coors.txt