Sample raster values at point location in QGIS – yet another way

A while back I wrote how one can sample raster values at point locations in QGIS using the Saga function ‘Add grid values to point’, which is available in the processing toolbox. Recently it was reported here that values uploaded from a floating raster layer are rounded up to an integer. I tried it myself in Saga, and it seems to work fine for me. But if you are running in problems with a function, it is good to remember that in QGIS you have have access to many libraries from multiple software tools. This means there are often more than one way to get things done.

And indeed, the processing toolbox offers another tool to sample raster values at point location; the GRASS GIS v.what.rast.points function. In this post I describe how to use this tool directly in GRASS, but you can use the tool in QGIS as well, as illustrated below.

Suppose we have the raster layer ‘aspect’ and the point layers ‘SamplePoint’.

Step 1

Now, need to add a column to the attribute table. In the example below I add the column ‘Aspect’.

Step 2

Now, open the function v.what.rast.points in the processing toolbox. Easiest is to start typing the function name in the search field. Fill in the required fields (raster name, name of the column to which you want to upload the raster values, and optionally the file name of the new point layer.

step 3

Now run the function, and you will have a new layer. Note that if you did not provide an name for the output layer, the function will create a temporary layer by default (this is the default behaviour for most if not all processing functions).

Step 5

After running the function, you’ll have a new vector layer, with an attribute table with the column ‘Aspect’.

The main difference with the SAGA ‘add raster values to point’ function is that first you will need to add the columns in which you want to store the raster values. So, a bit more work, but if you need to do this often, you can try to use the Processing modeler to create a new function / tool by chaining together the two different steps.

 

Advertisements

3 thoughts on “Sample raster values at point location in QGIS – yet another way

  1. Pete

    Hi
    I’m using QGIS 2.14.1 and grass 7.0.4 RC on Ubuntu 15.10. I can find the command v.what.rast in the Grass GUI but not in QGIS. I only have 169 GRASS GIS commands available in QGIS. Also SAGA does not work for me. Any idea how to make this command visible in QGIS?
    Thanks in advance!

    1. Rodrigo

      I couldn’t find it either. Funny thing is that I think I have used it a couple of weeks ago!
      Anyway SAGA’s tool solved the problem for me. I hope you can make it work!

Leave a Reply

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

WordPress.com Logo

You are commenting using your WordPress.com 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