jps services
  • Home Page
  • GIS Training Courses
    • QGIS Training Courses
    • ArcGIS Training Courses
    • MapInfo Pro Training Courses >
      • MapBasic Training Course
  • About
  • Blog

Using the Actions function in QGIS

9/5/2016

0 Comments

 
A useful feature within QGIS is the Actions function. This enables you to automate actions which are repetitive. An example would be associating an attribute field on your map layer to your web browser in order to create a search, based on that attribute. To enable this function you first to need to select a specific layer which contains the attribute you intend to link to your search engine enquiry.

In QGIS choose the layer you want to use in conjunction with the Action function. Double click on the layer to bring up the Properties Dialogue. Choose the Actions option from the left hand menu. You may not have any actions in the Action List. If this is the case you can load the defaults by clicking on the Add default actions button.
Picture
Choose the last item in the list: “Search on web based on attribute's value.” This example code enables you to click on the map and then perform an automatic search for the relevant web page associated with the selected attribute. In the Actions properties section is the code required for this action:-

http://www.google.com/search?q=[% "ATTRIBUTE" %]

The first part of the code refers to the google search parameter. If you enter any search into Google the first part of the search will be similar to http://www.google.com/search?q= followed by your search term then lots of additional information produced by Google.
If the default actions are not listed in the dialogue box,, click on the Add default actions which will load them.  Choose the Search on web based on attribute's value action option.
Picture
The [%”ATTRIBUTE”%] part is needed by QGIS to search for the selected attribute. To generate a meaningful action you need to change the data after the q= by selecting an attribute to search on. Choose an attribute from the drop down list. Then highlight the default code [% "ATTRIBUTE" %] in order to replace it. Next click on the Insert field button to replace the default text with the correct attribute data. Then update the code by clicking on the Update selected action button. Click on the Apply and OK buttons.
Picture
Select the Action button in the top menu in QGIS and then select the Search on web based on attribute's value option from the drop down list.
Picture
 Now clicking on the map will cause a web page to open related to the attribute data from that part of the map. Below is the web page automatically displayed when clicking on Corsica on the map.
Picture
If you try out this example and QGIS brings up an error message you may have to set out the full path to your web browser. For example "C:/Program Files (x86)/Mozilla Firefox/firefox.exe" http://www.google.com/search?q=[% "Name_Regio" %].
Picture
If you have difficulty making this action work using the full path should solve the problem.
Picture
0 Comments

Your comment will be posted after it is approved.


Leave a Reply.

    Author

    Joe Short BSc has been involved with various mapping solutions for over twenty years.  If you are considering implementing a GIS  or have ArcGIS Pro, MapInfo Pro or QGIS training requirements, jps services would be happy to be of assistance to your organisation. 

    Archives

    April 2020
    March 2020
    October 2019
    September 2019
    August 2019
    July 2019
    March 2019
    November 2018
    October 2018
    August 2018
    July 2018
    November 2017
    October 2017
    September 2017
    July 2017
    February 2017
    January 2017
    December 2016
    November 2016
    October 2016
    May 2016
    February 2016
    September 2015
    August 2015
    April 2015
    February 2015
    November 2014
    October 2014
    July 2014
    June 2014
    May 2014
    March 2014
    February 2014
    December 2013
    November 2013
    October 2013
    September 2013
    August 2013
    June 2013
    May 2013
    April 2013
    February 2013
    December 2012
    October 2012
    September 2012
    August 2012
    July 2012

    Categories

    All
    Arc Gis
    Arcview
    Autodesk
    Cad
    Gis Training
    Local Government
    Mapbasic
    Mapinfo
    Quantum Gis
    Relational Databases
    Saga Gis

    RSS Feed