Previous posts in this series
QGIS Plugin – RasterCalc
QGIS Plugin – OpenLayers
Point Sampling Tool
I have recently been working on a project that has required the extraction of information from a raster layer based on point positions in a vector layer. I’m not a big user of vector data, but I suspect this problem comes up from time to time. In my investigation of how to solve this, I found a great QGIS plugin, the Point Sampling Tool. The Point Sampling Tool allows you to easily extract values from a raster layer based on a vector point layer. In my case, I had data points collected over a lake and I wanted to extract the raster data from an optical layer. Here is a quick look at my project.
You can see there is a small lake, with point data irregularly spaced around it.
Now, open the Point Sampling Tool and you get the following dialog.
Select the point and raster layers and then select your output layer. In this case, I exported the point values to PST.shp. Looking at the attributes table for PST.shp, we can see the values from the raster band. However, it is just the values from the raster band.
The last step we need to do is merge the new point layer with the original point layer. It would be nice if the original attributes were carried into the new layer, but this is easy enough to do in QGIS. Under Vector->”Data Management Tools”->”Joint attributes by location”
After merging the layers, we now have a final layer with all the attributes from the original point layer, plus the values from our raster layer.
You can get more information about the Point Sampling Tool and links for downloading HERE.
That’s it. I hope this is useful in your work. As always, thanks for reading.
Previous posts in this series
QGIS Plugin – RasterCalc
QGIS Plugin – OpenLayers