Preparing reports with lots of survey photos takes time - this plugin automates the process.
Nowadays, it’s really easy to take georeferenced photos on site visits. Tools like Input can capture photos, descriptions and location information and bringing it all into GIS is straight-forward. However.. I recently discovered that people still spend significant amounts of time organising their photos into reports outside of GIS. This small plugin automates the process of getting the photos and their descriptions into Microsoft Word.
For this blog post I knocked-up a simple survey project based on the Field notes Mergin template. Points can have a photo, title and description amongst other fields. No comments on my gardening skills please!
When I sync the data back to QGIS, the attribute table looks something like this:
We’ll now use the HTML Table Exporter plugin to export the layer as an HTML table (this will let us get it into Word).
First install the plugin.
It’s an experimental plugin so you’ll first need to check the Show also experimental plugins option under Plugins > Manage and Install Plugins… > Settings.
When you have installed the plugin, open it using this button or via Plugins > HTML Table Exporter > Export table as HTML.
You should now see this:
Set Table to the layer you want to export. The image scaling option is described later, leave it at a small setting for the time being. Click OK to export and tell the plugin where to save the HTML file.
Now the data should be out of QGIS.. the next steps are in.. MS Word :o
Right click on the exported html file and open it with Microsoft Word:
Let’s see what it looks like:
OK.. we’re getting somewhere! At this point you’ll want to:
If playing with rotation, just focus on rotating a single image, we’ll batch rotate later as required. For now you want to get a feel of whether you want to adjust the scale factor in QGIS (to make the images smaller or larger) to save you having to resize them individually in Word.
I’ve decided to increase the scale factor from 10% to 15% so will now re-export.
Beware that Word has an exclusive lock on the html file when it’s open so you need to close it in Word before you can export it again from QGIS.
I settled for 10% in the end so I could get multiple images on each page in portrait mode. After removing the columns I didn’t want, the table in Word now looks like this:
To rapidly rotate images by 90 degrees, rotate the first one using Right click on photo > Size and position > Rotation then select subsequent photos and press the F4 key. This method is described in more detail here as well as other Word batch image rotation methods.
My document is almost finished. There are just a few small issues to iron out. Currently, the images are referenced by the Word document, not embedded. This means if I email the document to someone, the images will be missing. Let’s fix that by embedding the images in the word document.
First save the document as a Word document in Word’s native format (e.g. *.docx).
Next, locate the Edit Links to Files option:
Select all the linked images (the shift and arrow keys help here) and check the Save picture in document option and click OK:
Save the document, your photos should now be embedded within the document.
If you find your word document gets huge, you can use the method here to quickly batch compress all images in the document.
Input is a free and open source field data collection and mobile GIS app based on QGIS.