This article is an update of a previous one, “Integrate geolocated photos in QGis with Photo2shape” . In fact, the photo2shape plugin is no longer maintained and poses a lot of problems. We will perform the same operations with the new plugin “Geotag and import photos”.
In this article we will discuss how to create a layer of points in QGis including positions and links to “geotagged” photos. Therefore, we will use the QGis Photo2Shape plugin.
Geotagging consists of specifying the geographic coordinates of photos by changing their EXIF data (or tags). EXIF (Exchangeable image file format) data of a photo includes different information such as the type of camera, the date and time of the shooting etc…
If you have a camera equipped with a GPS, the location data can be included automatically. For example, if you have an iPhone you can enable geotagging pictures (see how to enable in the following page: How to turn photo geotagging on or off on your iPhone or iPad).
If you do not, instead of using some software such as Locr GPS Photo (free) or Robogeo (charged) to include a location in your pictures, you can use this new plugin (options geotag photos and photo tag).
Installing the Geotag and import photos plugin
The old photo2shape plugin used an additional Python module, ExifRead. Geotag and import photos uses an executable external to QGis to handle the EXIF format. This executable, ExifTool, is free and royalty free for all platforms.
You can download the latest version at http://www.sno.phy.queensu.ca/~phil/exiftool/
In Windows, once you have compressed the downloaded file, unzip it in a permanent directory and rename the file in exiftool.exe.
You will have to tell the plugin the location of this executable. To install the plugin in QGis, open the menu Extensions -> Install /Manageextensions
Make sure that the experimental extensions are displayed. If this is not the case, you will not find the plugin to be installed.
Select All and go through the list to find “Geotag and import photos”. Click on the line to select it and click the Install Extension button. Close the window. You have now a new menu line under Vector:
Click Settings and fill in the first line with the location where you have placed exiftools.exe
Leave the second line empty. The installation and plugin configuration is completed.
Loading photos in QGis
Let’s suppose you use an iPhone or equivalent. The images integration procedure in QGis is extremely simple.
1- copy your images in a directory. With the Windows Photo Viewer, for example, make sure that the photos are correctly positioned. Since you will link the photos to the layer created, the photos will be viewed directly with QGis. Therefore, it is essential that they are stored in the right place. 2-Start the creation of a shapefile corresponding to the geotags of your photos with the plugin Geotag and import photos: menu Vector -> Geotag and import photos -> Import photos
Fill in the directory where you have your photos. Select the tags to be taken into account (Here we have chosen Select all). For each tag, the plugin will create a column in the table of the output shape which will be filled with the value found for each photo.
Enter the location and name for the output shapefile. Click OK and if you have checked the Add result to canvas, you will see the points corresponding to the photos
If you open the corresponding table you see the fields that have been created.
The most important part is the field that contains the directory and image file name because this is what we will be using to display images in QGis. The name of this field is by default, filepath.
Viewing photos in QGis
To view pictures automatically when moving the mouse over a point of the shape, we will use the tooltips.
- Open the context menu of the created shape layer.
- Select item tooltips
- Select HTML
click on Insertanexpression
- In the Expression window type the following command:
CONCAT ( ‘<img src = »’, Filepath,‘ »Width =« 400 “> </ Img> ‘) The width value is to adjust according to the size of your photos.
- Click OK and OK.
Now, when you select the tool Infobulles, when you halt on a point of the shape, the image appears automatically.
View photos with eVis
Another way to view the photos, without activating the html tooltips is the extension eVis.
This extension is installed by default in QGis 2.18. Simply check that it is activated when opening the manager extensions.
> You will use both eVis tools:
If you do not see them in the toolbar, go to the View menu -> Toolbars and check the Database Toolbar
Click on the tool Navigator events eVis (the right button) The navigation window opens:
Click on the tab Options, set the field to take into account for displaying images ( filepath ) and check the box Remember, then click Save. Now, you can use the tool TooleVisIdEvent (left button). When you click on a picture point on the map, the tool opens a window with the data of the attribute fields as well as a window with the display of the image.