One way to avoid an explicit interpolation step* is to simply rasterize your CSV. Then set pixels having depth ≤ 0
to NODATA.
QGIS has a rasterization tool but it only operates on Shapefiles so first you'll convert your CSV to Shapefile.
- Add your CSV layer.
- In the Layers Panel, right-click to Save As... and give a name to your new Shapefile. If you know the CRS of your CSV, also set it in this dialog.
Now you can rasterize the points.
- In the QGIS menu bar, follow Raster > Conversion > Rasterize (Vector to Raster).
- Input file (shapefile): the shapefile layer you created in step 2.
- Attribute field:
field_3
(the depth)
- Set an Output file name, and I prefer to use GeoTIFF format.
- I usually prefer to set "Raster resolution in map units per pixel"; this way you use the same values no matter the extent of your map. Here it helps immensely to know the CRS of your data. In terms of your question, area that's not within "this setting" to the nearest observation will get cropped. Pick a value too small and even water pixels will get cropped out; a value too large and you throw away resolution of your depth readings. On your data, I chose 50 x 50 and you'll see below that it did alright, not perfect.
Finally, to crop away raster values less-than-or-equal-to 0. You have a couple options here:
- Convert these to NODATA following this method. NODATA values will not be painted by QGIS. Or...
- As a hack, if you just want a pretty map but care less about the integrity of your raster file, you can skip NODATA conversion (step 4) and tell QGIS to paint values
≤0
with full transparency. In the raster layer's Style properties, set colors to value ranges, making sure that the color 0 has opacity:
Below are my results. You can see that resolution 50x50 still leaves a few missing pixels in the river, because there were simply no depth readings within 50 map units of those places. The solution is set more map units per pixel in step 3 at the risk of smoothing out other depth readings, or to interpolate and find another method to clip unwanted areas.
* Some sort of interpolation is necessary, strictly speaking, to get an infinitesimally small point observation to extend to cover any small area: even rasterization technically "interpolates" a point value to cover its 50-unit x 50-unit pixel.
Processing | SAGA | Terrain Analysis - Hydrology | Flat detection
.