A GRASS GIS addon to upload raster values and labels to a point layer

In GRASS GIS you can upload raster values at positions of vector points to the attribute table of that vector point layer using the function v.what.rast. If you also interested in the raster category labels, you can have a look at r.what, which lets you query a raster map  on their category values and category labels.

However, the results of r.what are written to a text file. If you want to upload raster values and labels to the attribute table of a point vector map, you can use  v.in.ascii to import the text file created with r.what as a point vector layer in GRASS GIS.

Fairly straightforward, but wouldn’t it be even more convenient if you you had an option in r.what.rast to also upload the category labels? Well, that option isn’t there yet, so for the time being, I have written a simple addon,  v.what.rastlabel, that fills in the gap, i.e., it let’s you upload the values and labels of one or more raster layers at positions of vector points to the attribute table of that vector point layer.

The addon is available from github. If you are running GRASS 7.2 or above, you can simply install it using g.extension :

g.extension v.what.rastlabel url=https://github.com/ecodiv/v.what.rastlabel

If you are still running GRASS GIS 7.0, see this page on the GRASS GIS wiki on how to install scripts. After installing the addon, you can run it by typing v.what.rastlabel on the command line.

screenshot-from-2016-09-14-15-17-04

 

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