Sampling raster values at point locations in QGIS – an update

In a by now fairly old post I described how to sample raster values at point location in QGIS. The method I described used the ‘Point Sampling Tool’ addon. However, the function creates a new point layer, which only contains the values extracted from the raster layer. None of the fields in the original point layer is copied to the new one. It is possible to join the attribute table of the new vector point layer with the original attribute table afterwards using a spatial join as explained in that post. However, this will not work if your point data includes points with exactly the same coordinates.

Since I wrote that post, QGIS has come a long way. It now for example includes by default a processing toolbox which provides an easy and convenient interface to hundreds of functions from e.g., GRASS GIS and SAGA GIS. One of them will let you sample raster values at point locations too. Like the point sampling tool described earlier, it will create a new point layer with a new column for each raster layer sampled. The difference is that it will also copy over the columns that were already present in the original point layer.

The function I am talking about is the Saga function ‘Add grid values to point’. For this function to be available, you must have installed Saga GIS and than enable it in the processing options. To do this, go to: menu: processing – options and configuration – providers – SAGA and than select the Activate box. In Windows you will also have to define the path of the directory to which you installed saga.

After that, open the processing toolbox (go to menu: view – panels – toolbox) and look for the function ‘Add grid values to points’ in: SAGA – Shapes – Grid (easiest way to find that function is to start typing the name of the function in the search box). A new window will open:

add grid values to point function in the processing toolbox (a SAGA GIS function)
Figure: Add grid values to point function in the processing toolbox (a SAGA GIS function)

Now select your point layer (1), one or more grid layers (2) and the interpolation method (3). If you simply want the grid values at point location, use the default ‘nearest neighbor’ method. Last, give the path and name of the output shapefile (alternatively, the function will create a temporary file, which you can than save using the save as option in the file menu.


5 thoughts on “Sampling raster values at point locations in QGIS – an update

  1. Pingback: Sampling raster values at point locations in QGIS | Ecostudies

  2. Katya

    Thanks a lot for your quite clear instructions, as for previous method and for this one! Your blog is wonderful, and you are doing really necessary work!

  3. Helen

    I’ve had a problem with the Saga function Add grid values to point. It produces a value that rounds up to an integer (however it does still display the value with a decimal i.e. 4.000000). This reduces the accuracy of our data and means we can’t use the tool

    Any other ideas to ensure the process doesn’t change the number at all would be greatly appreciated.

    1. Saga isn’t currently working for me in QGIS, but I just tried with Saga directly, using a real number raster layer. The function uploads the real numbers to the attribute table, without rounding. I therefore suggest you report your problem with the QGIS mailing list, there you are more likely to find a solution for your problem.

      In the meantime / alternatively, you can also use the v.what.rast.point function (this is a GRASS function available in the processing toolbox). I wrote a small how-to here:

  4. Pingback: Sample raster values at point location in QGIS – yet another way – Ecostudies

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s