Getting action into your layer

QGIS provides the option to perform an action based on the attributes of a feature. This is useful if you want to run an external application or view a web page based on one or more values in your vector layer. How to define and run an action is explained in the user guide (, check the section on ‘Action tab’.

I needed this feature to extract information from a vegetation map for Tanzania I am working on. The layer has fields for the vegetation type and an unique ID. I want list both the ID and name of the vegetation type for a number of polygons and export them to a text file. Following the user guide I tried:

 bash -c "echo \"%cat %PNVs2\" >> /home/paulo/output.txt"

Unfortunately nothing was written to the file ‘output.txt’. After trying different options, I found out that the following syntax does work.

bash -c "echo '%cat %PNVs2' >> /home/paulo/output.txt"

I am not terribly familiar with bash syntax (OK, make that a not at all), but it seems things might work slightly different depending on the system you are working on (I am for example working on Ubuntu).

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