0

I am using QGIS 3.4.4 Madeira version trying to delineate the stream and catchment areas of a small Bay in Honduras based on the technique of Hanz van der kwast tutorial "Stream and Catchment delineation in QGIS 3". I imported DEM > reprojected > Used SAGAs Fill Sinks (Wang and Liu) > USED SAGAs Strahler Order to delineate streams.

What happens is that the tool cannot decipher what is land at sea level and what is the actual sea and creates channels running straight off into the ocean. How can I correct the DEM before using stream delineation tool so I don't have my streams running far off into the ocean? I want them to stop when they hit their drainage point (i.e. Bay/Ocean).

I've already tried clipping the raster to a polygon of the land area to simply cut out the ocean from the raster, but then the results don't work as I am guessing I cut out important information that the tool needs to process (streams and basins are completely missing).

enter image description here

  • are you open to a python-based solution? – Paul H Mar 25 at 22:35
  • 1
    If you have a polygon for the land only, you can simply crop the vector streamline layer to get rid of the straight streamlines in the ocean/sea. However, if you want to clip the raster layer, use clip tool and specify -9999 in the nodata value, and the ocean/sea will disappear. – ahmadhanb Mar 26 at 1:14
1

I would create a new raster dataset with the oceans masked out. Assuming any cell with an elevation less than or equal to zero, I would do:

import numpy
import rasterio
with rasterio.open('path/to/orig.tif', 'r') as orig:
    land_and_sea = orig.read(1)
    meta_data = orig.meta.copy()

nodata_value = -9999
meta_data['nodata'] = nodata_value
with rasterio.open('/path/to/masked.tif', 'w', **meta_data) as masked:
    land_only = numpy.where(land_and_sea > 0, land_and_sea, nodata_value)
    masked.write(land_only, 1)

Then you'd repeat the process of generating the stream network.

Alternatively, you could create a polygon from the masked raster and clip the stream to that polygon.

  • I am open to using a python based solution.. not sure if I can accomplish it as I've never used python commands. Should I try to copy/paste this command into my python for my original clipped dem? – DatOh Mar 25 at 23:14
  • If you don't have any experience with python, getting your computational environment set up to run this would be quite a challenge and it won't be as easy as "copy/paste" as you'd need to tailor the file paths to your system – Paul H Mar 25 at 23:36
  • I see. Then before I spend the next week or two learning python from scratch, any easier solutions you can suggest? – DatOh Mar 25 at 23:54
  • 1
    If your stream lines are extending too far out into the ocean, it seems to me that you need to modify you clip layer - perhaps extend it slightly away from land. – Stu Smith Mar 26 at 1:11
  • 1
    @DatOh what Stu said or I would just clip the stream lines you already have – Paul H Mar 26 at 1:34

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.