I have bathymetric survey data in the form of XYZ. X and Y are coordinates while Z is river bed level (elevation) from a datum. These are about 14000 irregularly located points within a river. Now I want to create a contour maps and afterward a 3D surface to show spatial pattern of river morphology. I have created DEM in the form TIFF raster using ‘Topo to Raster’ tool of ArcToolbox of ArcGIS 10.2. But when I generate contour from the TIFF file created, it generates contours not only for the river but also for area outside of river bank. Even more the outer contours are not only unwanted but unrealistic as well.

After ‘Topo to Raster’ what do I do to get the contours in required shape?

I am not an expert but have beginner level command on ArcGIS 10.2, QGIS 3.4 and Surfer 13.

How do I make contours (and 3D surface) only confined within a river ( and not outside) using QGIS

  • You can achieve something meaningful only if you have elevation model of surrounding land. Convert banks to 3d line and use them and your points for triangulation.
    – FelixIP
    Nov 28, 2018 at 5:06
  • Sorry but I do not get by “convert banks to 3D lines”. How to do that? According to reply from @csk I am working to get a polygon as river boundaries using Google Earth. Is it necessary step to convert the river banks to 3D. Kindly elaborate a little more. Thanks.
    – datakeen
    Nov 28, 2018 at 5:59
  • Use interpolate shape from 3d analyst.
    – FelixIP
    Nov 28, 2018 at 8:40

2 Answers 2


If you don't already have a river polygon, get one. Use the river polygon layer to crop the contours layer.

The tool for this in QGIS is called Clip. You'll find it in the Vector menu > Geoprocessing tools.

Your other GIS programs will have equivalent tools.


I'm not sure about QGIS, but this is very common to do in Surfer. A good way to do this in Surfer is to have the river channel defined as polylines (or a polygon), and then use the polylines or polygon as breaklines when gridding the data in Surfer. You can then clip (blank) the grid outside the polygon to remove the data.

I think it's important to grid the data with the breaklines (not just clip it afterwards), because then the contours take this data into account. If you just grid the data and clip/blank, you could get contours going right into the river bank - which doesn't usually happen.

For example, in Surfer you can:

  1. Get the river channel boundary polylines or polygon in BLN file format. You can either add an empty base layer, edit the layer, draw the river channel polylines, stop editing the layer and export the layer to a BLN file. Or, if you have the channel boundaries saved in another format already (e.g. SHP), you can load the SHP as a base map, turn off the axes, and export it back to a new BLN file.

    1. Open the BLN file in the Surfer worksheet and add a column of Z values in Column C for all the XY points. This could be 0 (if the river bed level data is negative), or whatever value you want to assign to the river channel boundary. Save and close the file.

    2. Click Grid | Data and grid the river bed level data. In the Grid Data dialog, click the Advanced Options button and on the Breaklines (or Faults and Breaklines) tab, load the BLN file as a breakline file.

    3. Click OK to finish gridding the data. Gridding the data with breaklines is a great way to grid lake, river or coastline bathymetry.

    4. If you want to remove the data outside the river channel, you can erase this. It would be easy in Surfer 16 (the current version) in the revamped Grid Editor. In Surfer 13 though, you could still do this using the Grid | Blank command. Convert the polylines defining the river channel into a single polygon (load as a base layer, edit base layer, select polylines and connect them into a single polygon, stop editing base layer, turn off axes and export to new BLN file). Open the BLN file in the Surfer worksheet and make sure cell B1 has a 0 in it (that’s the blanking flag value to tell Surfer to remove the data outside the polygon). Close and save the file. Then once you have the river channel defined as a polygon, you can use the Grid | Blank command in Surfer to blank the grid with the polygon. This will create a new blanked grid. It will only have the data inside the river channel.

I hope that helps!

Thanks, Kari

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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