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