Enable & Use iShare GIS Print Template Export plugin for QGIS


Overview

5.8.0+

Astun Technology have provided a QGIS plugin which may be used to convert a QGIS Print Composer Template into an iShare GIS Print TemplateThis means that new custom Print Templates can be easily designed for iShare GIS using the 'what you see is what you get' tools in QGIS.

Requirements

  • iShare GIS V5.8.0 or above configured for the HiDPI Print Plugin.
  • QGIS 3 (tested with 3.18.3) or QGIS 2 (tested with 2.18.18)
  • An Astun Services account

If your iShare GIS installation is not currently configured for the HiDPI Print Plugin (available from V5.8.0)  and you wish to use this QGIS plugin, then please see Enabling the HiDPI Print Plugin for iShare GIS for further details.

Limitations

While efforts have been made to ensure that the conversion process should produce an iShare GIS print template that is very similar to the original, the process is automated, and therefore we cannot guarantee that the output will be exactly the same. If there are obvious differences, please log on to the Helpdesk and Customer portal to create a Support Request outlining the problem and attach the QGIS print template to it and we will investigate whether improvements could be made to the converter.

Known issues with QGIS versions greater than 3.18

Unfortunately with versions of QGIS greater than 3.18 there are a couple of known issues with the plugin which require manually editing the exported HTML. Please see Workaround for QGIS iShare GIS Template plugin issues.

Step 1 - Install the iShare GIS Print Template Export plugin

Download the QGIS Plugin

Download the iShareGISPrintTemplateExport plugin.

To download the .zip file you need to click on the Code dropdown and click Download ZIP e.g.

Copy Plugin to the QGIS Python plugin folder

  • Extract the zip file
  • Copy the iShareGISPrintTemplateExport folder to the QGIS Python plugins folder e.g. on Windows.
QGIS 3QGIS 2

C:\Users\{username}\AppData\Roaming\QGIS\QGIS3\profiles\default\python\plugins\

C:\Users\{username}\.qgis2\python\plugins\

Configure the Plugin

  • Open QGIS
  • Make sure that the Project is using absolute "Save paths". To do this select Project Properties from the QGIS Project menu.
  • Now we need to configure the folder where your exported print templates will reside. Select Options from the QGIS Settings menu and click on the Layouts tab (QGIS 3) or Composer tab (QGIS 2).
  • Now you can click on the Add new path button  to add a valid path.
QGIS 3QGIS 2


  • Now you are ready to configure the actual plugin. If you look on the toolbar you will see the new button for the iShareGIS Print Template Export plugin e.g.

    You may need to close and reopen QGIS to see the new button.


  • Click on the button and select the Settings tab.

    Enter the Astun Convert URL which is the URL to the Astun Services and the Username and Password that you have been provided with by Astun Technology. You will need to replace [username] in the following URL with your customer user name.

  • Click OK.

Step 2 - Create your QGIS Template

Create your template using QGIS Layout / Composer

  • Open QGIS
  • Select New Print Layout (QGIS 3) or New Print Composer (QGIS 2) from the Project menu or the corresponding Layout / Composer Manager if you have an existing template you wish to use.
QGIS 3QGIS 2


  • The template must contain a single Map element.
  • It must also contain a single Legend element. The legend's display can be controlled by the user in iShare GIS.
  • Labels may be added for displaying text. This text can either be static, predefined dynamic such as the user's name or editable where the user provides a map title for instance.

  • You can also add shapes such as coloured rectangles to create panels and or add images, scale bars or north arrows . For details on how to use the QGIS Print Composer please see the QGIS Documentation or sign up to one of the Astun Training courses.

    Any images that you add to your template must currently be in .PNG format.

  • You can also add Predefined Dynamic Labels which are dynamically populated with information from iShare GIS or User-Editable Labels which are manually populated by the user when they select to print the map in iShare GIS. 

Add Predefined Dynamic Labels

iShare GIS templates can contain elements that will be populated automatically by iShare at run time. In QGIS these are added as Labels.

  • Add a Label to your template and position and style appropriately.
  • The text of the label in QGIS does not matter, but you may find it helpful to add something sensible to help you interpret the QGIS template as you use it.

  • Set the ID of the label to one of the following Class entries.

The following is a list of the Classes that may be used in your HiDPI Print Template.

ClassValueNotes
ishare-user
Current user and domainFormatted as: user@domain
ishare-timestamp
Current timeISO datetime format: e.g. 2018-03-23 14:37:39 
ishare-projection
The in-use map projection codeE.g.: EPSG:27700
ishare-attribution
Copyright taken from the base MapSource
ishare-scale
Current map scale
ishare-centre

ishare-centre-x
ishare-centre-y
Central co-ordinates of the current view of the map

Format for ishare-centre: x, y

Units are rounded to a number of decimal places dependent on the projection units: 5 for degrees; 3 for miles and kilometres; and 0 for everything else.

ishare-bbox

ishare-min-x
ishare-min-y
ishare-max-x
ishare-max-y
Corner co-ordinates of the current view of the map

Format for ishare-bbox: min-x min-y max-x max-y


Units are rounded to a number of decimal places dependent on the projection units: 5 for degrees; 3 for miles and kilometres; and 0 for everything else.

Add User-Editable Labels

iShare GIS templates may also contain editable elements. These will appear in the Print Options in the left-hand panel where you can edit the contents. For more details see the Generic User-Editable Elements section in Creating your own HiDPI Print Template.

In QGIS these are also added as Labels but they require you to add Composer Variables.

  • Add a Label to your template and position and style appropriately.
  • Set the Main properties of the Label to be the text that you wish to be displayed by default in your iShare GIS Print Template e.g. Enter map title.
  • In the Variables panel:
    • Add a Layout Item (QGIS 3) / Composer (QGIS 2) Variable named editable and set the Value to true.
    • Add a Layout Item (QGIS 3) / Composer (QGIS 2) Variable named field and set the Value to the name of the field e.g. title (no spaces, all lower case). e.g.
QGIS 3QGIS 2


In iShare GIS the Value of the field variable above will be used to label the text entry field in the Print Options dialog (with the first letter capitalised) e.g.

Save your QGIS Template

Once you are happy with your template select the Save as template button to save the template into the folder that you previously configured for your exported Print Templates.

Step 3 - Convert your QGIS Template using the plugin

Now that you have created your template you need to convert it for use with iShare GIS.

  • Click in the  button to run the plugin.
  • On the Main tab, select the template you wish to export.
  • Either enter the destination directory manually in the text box or click on the ... button to browse for a directory.
  • Click OK.
  • If you browse to the folder where you selected to export your QGIS template you will see that it has generated a templatename.HTML file with the same name as your template and a templatename_images folder with the images that have been used in the template.

Step 4 - Deploy the Converted QGIS Template to iShare GIS

You need to copy both the HTML file and the images folder to the iShare GIS server.

  • Both the templatename.HTML file & the templatename_images folder need to reside in the WebApps\WebService\custom\print\templates folder on the iShare GIS server. 

Step 5 - Use the Print Template in iShare GIS

Once you have deployed the template it will be available for selection under the Print Options in iShare GIS. For details please see Printing your Map using HiDPI Printing.

Known issues with QGIS versions greater than 3.18

Unfortunately with versions of QGIS greater than 3.18 there are a couple of known issues with the plugin which require manually editing the exported HTML. Please see Workaround for QGIS iShare GIS Template plugin issues.