• Blog posts

    Bio

    By David Crowther

    QGIS___Hyperlinking_to_URLs_-_1.PNG

    Question:

    How can you perform a hyperlink in QGIS to a URL, Document or Photograph?

    Answer:

    QGIS allows you to perform several ACTIONS related to features in your GIS layers. One of those Actions is to open a URL/Hyperlink to a document or photograph stored on a server.

    In this example we will use some Planning Applications in Liverpool where we will open the Planning Application document or photograph associated to each map feature.

    In the attribute table we have two columns which store the filename and extension for those documents and photos – Upload1 and Upload2.

    QGIS___Hyperlinking_to_URLs_-_2.PNG

    Those files are stored on a server and so by adding a static URL of – http://try.dynamicmaps.co.uk/MapThatDocs/9713/Images/-  at the front of each record it will successfully open that file into a web browser window.

    QGIS___Hyperlinking_to_URLs_-_3.PNG

    So, in the example above, the photo stored in the field Upload 2 would have a full URL reference of  - http://try.dynamicmaps.co.uk/MapThatDocs/9713/Images/4261_1_prescot_housing.jpg - which would open into a browser:

    QGIS___Hyperlinking_to_URLs_-_4.PNG

    For QGIS to enable this URL, we will add an ACTION that will generate the URL using the static part of the URL and then the variable which is the files name as stored in the field Upload2.

    Right click on the Planning Apps Layer > choose Properties and then the ACTIONS tab.

    QGIS___Hyperlinking_to_URLs_-_5.PNG

    You can add Actions 1 by 1, or simply choose Create Default Actions to get a list of default ones that you can then edit.

    QGIS___Hyperlinking_to_URLs_-_6.PNG

    Remove the ACTIONS that we don’t want and keep one example of the OPEN URL Action.

    QGIS___Hyperlinking_to_URLs_-_7.PNG

    The default Action will open. In this example it will open a google search, based on the variable of what the user searches for.

    QGIS___Hyperlinking_to_URLs_-_8.PNG

    Edit the default action to give it a better name, choose how it is activated and update the Action Text using the static URL with the filename as stored in the column %upload2%

    https://try.dynamicmaps.co.uk/MapThatDocs/9713/Images/[% "upload2" %]

    QGIS___Hyperlinking_to_URLs_-_9.PNG

    Save, Apply and OK and now test the Hyperlink using the ACTIONS tool from the main toolbar in the map window.

    QGIS___Hyperlinking_to_URLs_-_10.PNG

    Then click on the map feature with this tool and the hyperlink will be activated.

    QGIS___Hyperlinking_to_URLs_-_11.PNG

    You can create as many ACTIONS as you want, for example adding another so that it opens the PDF documents as recorded in the Upload1 field.

    QGIS___Hyperlinking_to_URLs_-_12.PNG

    QGIS___Hyperlinking_to_URLs_-_13.PNG

    QGIS___Hyperlinking_to_URLs_-_14.PNG