folder location of image files when a sony xperia smart ... · page 1 importing and displaying...
TRANSCRIPT
Page 1
Importing and displaying photos in a QGIS December 2017 David Lovelace
1. Image file EXIF data
In addition to the pixel values of a photo, a digital camera image file contains data
such as shutter speed, focal length, date and time and the location co-ordinates if the
camera has a GPS chip as do most smart phones (ensure that GPS enabled).
Such image file data is coded in a universal format called EXIF (Exchangeable Image
File Format). Extracting EXIF data from each photo so that it can be used in a GIS (or
any other application) requires the powerful free utility ‘exiftool’ which you download
as a ‘Windows Executable: ExifTool.zip’ from: http://exiftool.sourceforge.net/
Unzip and rename (press F2) the .exe file from ‘exiftool(-k).exe’ to ‘exiftool.exe’
[the (–k) tag allows drag & drop which is not needed here – you can have both]
Drag exiftool.exe in your ‘C:/Windows’ folder [if you get some message ‘you need
administrative rights..’ click ‘continue’], exiftool should now run from the command
line (press the win key and type ‘cmd.exe’). On typing ‘exiftool’ at the command
prompt (>) you should see this below, if so, exiftool is recognised by your system.
2. The geotag and import photos plugin
QGIS has a plugin based upon exiftool which greatly simplifies the process of
importing geotagged photos into GIS (to import geo-unaware photos go to page 5):
Open QGIS and install the plugin ‘Geotag and import photos’ (connect to internet to
access the plugin store). As this plugin is ‘experimental’ you need to make it visible in
the plugin dialog > setting > tick ‘show experimental plugins’.
Folder location of image files when a Sony Xperia smart phone is connected to a laptop
Page 2
Select it by entering ‘geotag’ into the search box next to ‘All’. Once installed, the
‘Geotag and import photos’ plugin should appear under the vector tab and as icons:
Because the Geotag plugin relies on exiftool.exe you need to manually set the path to
exiftools.exe on your system in ‘Vector> geotag>settings’ and type its path
(‘C:\Windows’ if as above). Click the icon or keys SHIFT+i to show the import
photos dialog: check ‘Add result to canvas’ for a vector layer to appear on the map.
! Ensure that ‘Recurse subdirectories’ and ‘Append to..’ are unchecked if there are no
subdirectories or anything to append to, otherwise the plugin can crash QGIS (an
occasional hazard with some plugins).
‘Path to photos’ > ‘browse..’ to folder of photos (the black command line window
briefly appears). Give the output shape file a name in its desired location.
Page 3
Optionally include any EXIF required fields. In this example I’ve checked
‘GPSDateStamp’ and ‘GPSTimeStamp’ in the field option box (see right panel).
Clicking ‘OK’ creates a point vector layer in the layer panel. Since this comes from
GPS it will be in latitude and longitude which you can confirm by clicking the layer
name in the layer panel and clicking ‘general’, you will see that the Co-ordinate
Reference System (CRS) is ‘EPGS:4326, WGS84’ the standard for GPS units.
The screen shot below is what the vector layer of GPS embedded photos should look
like when imported into a QGIS project with a single raster layer in the Ordnance
Survey CRS defined as EPSG:27700. The points in pink are tree photos.
QGIS will re-project a vector layer, whatever its CRS, ‘on the fly’ to match that of the
project CRS. [‘Settings’ > CRS make sure that box ‘Re-project on the fly’ is ticked].
With the photo point layer active in the layer panel (active layer is highlighted in blue)
click on the attribute table icon (or quicker F6 on the keyboard) to show the data
fields. The geotag plugin will have created the full path to the photos, the photo image
file names and the mobile’s GPS date and time data. You can add your own data fields
such as species, girth, condition etc associated with each tree photo. The bottom bar
shows the OS easting and northing and the OS projection EPSG:27700.
Instructions on how the use all the functionality of exiftool are on the website:
http://exiftool.sourceforge.net/
http://exiftool.sourceforge.net/geotag.html For instructions to use geotag
Page 4
3. The eVis plugin - visualizing the photos and their attribute data as popups
The main way to view the photos on the map is via the eVIS plugin. eVis is installed
by default but needs to be enabled by clicking the box in the plugin dialog. eVis icons
appear under Database > eVIS or they can be more visible by placing them on the tool
bar: bring up the Toolbars menu View > Toolbars or right click the blank space on the
right of the toolbar and tick ‘Database Toolbar’.
Clicking the eVIS ‘Event Browser’ should now show the images. As above, the
browser has extracted the attribute data from the active photo point vector layer, but
you will probably have to open the ‘options’ dialog and alter a couple of things:
The attribute field must be set to the path field and since ours are ‘absolute’ paths i.e.
they are defined in full off the main drive and not ‘relative’ to another folder, the ‘path
Page 5
is relative’ needs to be unchecked. Clicking ‘display’ will now show the geotagged
photo for the point + other data with the selected location starred. Clicking ‘Previous’
and ‘Next’ steps through the photo vector points in succession – the map view being
automatically centred on the active photo point each time.
Photos in the eVIS display can be zoomed in or out by clicking on the left or the
middle of the three buttons just top right of the photo area. The right hand button
restores the full view. They should have ‘+’ & ‘-’ on the buttons but they seem to be
missing – a quirk of the plugin.
4. Viewing photos via the information icon and using eVIS to compare photos
Photos can also be viewed more directly without the eVIS plugin by activating the
information icon (or keyboard CTRL+ Shift + i) and clicking the point which brings
up the ‘Identify results’ dialog. This is a quick way to display attribute information
about any vector feature in QGIS. The ability to view an image within this
information dialog box requires the ‘path’ field (containing the photo file and its path)
to be recognised by QGIS as a ‘photo field’. This is done by clicking on the layer in
the layer panel > Fields > select the name of the path field (‘filepath’ in this case) >
Edit widget > Photo. Now when a photo point is clicked with the ‘Identify’ icon, the
photo will be displayed when the icon for the ‘View feature form’ is clicked. To make
the photo display a one click action, check the ‘Auto open form’ box on the bottom
right of the ‘Identify results’ dialog box. Now every click should produce the photo
along with other data in the attribute table similar to the eVIS display except that the
‘Identify results’ dialog remains fixed as the map is panned.
You can display photos in eVIS as well as in ‘Identify results’ on the same screen
which enables you to compare one photo in a fixed location with a series of other
photos in their respective centred locations in eVIS.
5. Geo-locating photos in GIS from non-GPS cameras using mutual time data
The exiftool -geotag function inserts GPS co-ordinates into a folder of non-geo-tagged
digital images by matching their EXIF time stamps with those of the track points of a
GPS unit carried along with you while the photos were being taken.
Synchronize your digital camera time to that of the GPS (which takes its time from the
orbiting atomic clocks) by taking a calibration photo of the GPS unit on the same day
of your survey. Below is my (non GPS) Sony NEX-6 in Date/Time setup mode along
side the GPS. Even though only minutes are displayed, camera EXIF records seconds.
Page 6
When I’ve compared the GPS time and the camera time of this camera model over an
11 day time period, the drift in difference was only 3 seconds (8 seconds a month), so
once tht camera is synchronized to the GPS you can forget about it for a while. I don’t
know about the clock drift for other camera models, so it would a worthwhile exercise
to record the relative time drift over a week or so for another camera model.
If camera time is not set either because the surveyor doesn’t know how to, has
forgotten to set it or the camera remains set to some default time, exiftool can correct
any time difference between the GPS and photo time stamp.
To show time difference, take a photograph of the GPS unit. Windows file explorer
will display most of the EXIF data by right clicking the photo file > properties
(bottom of dialog) > Details. See below.
Only minutes are displayed in file explorer but the internal camera timings are usually
to the nearest second as can be seen by using exiftool to extract the date & time for
this calibration photo (see section 8 page 19 below).
There is a simple ‘point and click’ proprietary date/time shift program which is a
visually convenient interface to exiftool and be downloaded here:
https://www.relliksoftware.com/exifdatechanger/download
The free version only deals with jpg format images. However I will be focussed on
using the exiftool on its own because of the greater functionality you will have access
to which you learn to use it.
Page 7
6. Creating a batch file to automate exiftool actions.
If you are doing a lot of photo tagging in GIS you will access flexibility and power if
know how to create and run batch files, a very easy process. Open Notepad or other
text editor and type as illustration below. I’ve used the free feature-rich Notepad++
which would strongly recommend - download from https://notepad-plus-plus.org
Save the file with any name you like – I’ve called mine ‘timeshift&geotag’ then save
the file as a ‘bat’ file: timeshift&geotag.bat. This file type is listed as under the down
arrow to the right of ‘save as type’ box in Notepad++. Type the following:
Line 1 the black command prompt window appears and shows things are working.
Line 2 the camera is 16 seconds slow relative to the GPS time so this tells exiftool to
add 16 seconds to the time stamps of all jpg images in the folder. If the camera time
was fast subtract the time offset by typing a ‘-’ instead of the ‘+’ thus:
DateTimeOriginal- rather than DateTimeOriginal+ in the above code.
Line 3 tells exiftool to match the time stamps all photos in the same folder with the
time stamps of the GPS track points.
If the GPS/photo are already synchronized line 2 can be removed or ‘commented out’
(type rem in front of the line) so all you need is one line of code 30 characters long.
Notepad only offers ‘txt’ as a file type so you must manually type ‘bat’ in place of
‘txt’ when saving it [also Notepad doesn’t have nice context colour coding].
Either way, you have now created a ‘batch’ file recognised by Windows as a ‘script’
which runs the commands. It is convenient to save the batch file to the desktop either
by dragging from its location or by saving the file directly into the desktop folder
(usually C:/users/username/desktop). This will create a batch file icon on your desk
top to which you drag one of the images from the folder. This action will run the batch
file and a csv file will appear in the photo folder with the results of the batch file.
Open photo folder and 3 batch file icons on the desktop which do different things:
Page 8
This screen shot shows one of the photo files being ‘dragged’ on top of the batch file
icon which creates a table of dates, times and locations of the files along with a
confirmation message that batch file is about to run (Windows 10). In this case the
batch file creates a csv file with the date, time and file path of every photo file in the
folder. The csv file places itself in the same folder as the source file:
We will be using this csv file to geotag photos from manually positioned points in
section 8 below.
7. Extracting and storing EXIF data from photos
To extract, display and store EXIF data from a folder of photos type the following: @ECHO OFF exiftool -common -csv *.jpg >> Exif_Data.csv
‘save as’ with the .bat extension with an understandable file name such as
commonEXIFdata.bat and place onto the desktop as explained in section above.
Dragging one of the photos onto the desktop icon for batch file produces this csv file
in the same folder: [Excel thinks 1/80 second shutter speed January 1980 – silly Excel!]
Page 9
If you just want the date and time use the –DateTimeOriginal tag instead of –common
@ECHO OFF exiftool -DateTimeOriginal -csv *.jpg >> Exif_DateTime.csv Produces the following table:
For manually geotagging photos in QGIS (see below) you will need access to the full
path of each photo file. For that exiftool has thoughtfully included the –FilePath tag.
This batch file produces a csv file ‘Exif_DateTimePath.csv’ in the same folder and
which we will use to geotag non-GPS photos from point data (see below):
The above methods will extract data from every photo in the folder but sometimes you
want a batch file that extracts data from just the one file. For the time stamp
synchronization method above you need to extract the time, including the seconds,
from the calibration photo of the GPS unit and may just want this data on its own.
This code extracts time data including the seconds a single file, the photo of the GPS
unit in this case, when dragged and dropped onto the batch file with this code:
Page 10
Dragging the GPS unit photo onto single image data extraction icon dumps the time
data as a csv file into the same folder which includes the seconds number.
You can create your own batch files to carry out more sophisticated actions but you
need some familiarity with DOS commands (before Windows spoilt us all with ‘point
& click’), here’s a handy list with details of each command http://ss64.com/nt/
8. Geo-tagging photos from point data in QGIS
This is the situation where the point locations of geo-unaware photos are manually
positioned in a vector point layer, for example, by associating the particular tree
crown in the aerial photo layer. The coordinates of each of the positioned points are
then inserted, using the geotag plugin, into the EXIF data of each photo file so they
can then be imported and displayed just like any other geo-tagged photos.
The work flow starts with creating a new temporary vector layer in longitude and
latitude, the universal system based on the shape of the Earth and used by all GPS
devices which uses CRS WGS 84 or in EPSG notation 4326. QGIS maps will be in
projected coordinates CRS OSGB 1936 or in EPSG notation 27700.
[A key concept in GIS is the difference between ‘projected’ coordinates - 2D maps
optimised for each part of the globe and ‘geometric’ coordinates of longitude and
defined on the 3D spheroid of the Earth.]
Because your QGIS installation will have been set up to create maps in EPSG: 27700
when creating new vector layer (CTRL + shift + N) its CSR will be 27700 by default
so you need to change the CRS to ‘EPSG:4326 WGS 84’ in box that pops up:
Page 11
It is likely that you will have used 4326 already so if you click on the CRS icon to the
right of the box these two will probably be listed, so click on WGS 84, OK the dialog,
give the new shape file a name and location. Once the photos are geotagged, the layer
has done its job and can be deleted, so call it ‘temp1’ or something.
Now create the photo points in their respective locations (make sure the layer is in edit
mode). Each time a point is created the ‘Features Attributes’ table pops up with the
default attribute field ‘id’so type in the photo file name into this ‘id’ box. These will
be used to label the points to associate the correct photos.
Create labels for the layer (2x click layer name >labels).
The attribute table will look like this for the 4 photos used for this work flow example:
As an aside: if you select & copy the attribute table then paste it into an Excel
worksheet you can see the long, lat coordinates of each of your positioned points:
Note that the 4 points have red crosses (in edit mode) and are yellow (are selected).
The plugin needs the file name and full path of each photo so we use the csv file
‘Exif_DateTimePath.csv’ that we already created in section 7 above .
Open this Exif_DateTimePath.csv file which will have the full path and file names of
all photos in the folder and adjust the QGIS and Excel windows so both are visible, or
you can ‘Alt + TAB’ between the two.
Page 12
Launch the geotag plugin in tag mode (Shift G), select the created layer, label ‘id’
field, only check the 3rd box and click ‘Populate table’ which now displays the long
lat coordinates and an empty ‘path to folder’. Your screen should now look like this:
At this point you might be thinking that there must be a way of associating the names
of photo files in the csv file with the ‘Label’ field in the geotag dialog so that the ‘Path
to folder’ is auto populated; after all, they are just two tables with a common key,
however I can’t find one. I’m sure that functionality could easily be coded but that’s
the thing with open source software – someone has to spend the time to bring it about.
Meanwhile you just have to copy and paste from cells in the FilePath column in the
csv into the equivalent cells in the ‘Path to folder’ to look like this:
Page 13
Click OK and the photo files will now be geotagged with the points in the ‘temp’
points layer which can now be deleted.
Now use ‘import geotagged photos’ exactly as section 2 above to create a vector file
of photos locations. For this example I’m using the same 4 photos so I’ve called the
new imported photo point layer ‘geodumb4’.
As described in section 4 above associate the filepath field with ‘Photo’ so QGIS
knows it’s an image:
Now when the points are clicked with the Identify icon (CTRL+shift+i) the previously
geo-dumb photos now display in their correct locations:
Although this looks good the photo layer is not in projected coordinates but remains in
WGS 84, longitude and latitude, its just that QGIS is re-projecting it ‘on the fly’.
Different layers should all be in the same projection which is essential if you doing
things like start merging layers or copying points from one layer to another.
QGIS has a simple ‘Reproject layer’ function which will permanently reproject a layer
from one CRS to another. The function is not immediately obvious but resides in the
suite of powerful utilities called the ‘Processing Toolbox’ which are not plugins but an
integral part of QGIS.
With the layer active click ‘Processing’ > ‘Toolbox’ (or quicker CRTL + Alt + t) to
display a veritable Aladdin’s cave of sophisticated geo-processing functions. The one
Page 14
we want is under ‘QGIS algorithms’ scroll down to ‘Vector general tools’ scroll down
again to ‘Reproject layer’ and activate.
[The processing toolbox kindly remembers which tools you recently used under the
heading ‘Recently used algorithms’ so don’t subsequently have to hunt through the
toolbox again].
This pops up the ‘Reproject layer’ dialog which displays the current CRS of the layer
and you put in the CRS you want (27700). When this is run a new shape file is created
identical except that it now has same projection as the other layers. By default it is
named ‘reprojected’ but you can give it any name you like.
Page 15
I’ve named it ‘geodumb27700’ for this exercise:
You will see that re-projected photo points are in the identical locations, so the
original one in long lat can be deleted. You can always check the CRS of any layer by
hovering the mouse over layer name in the layer panel and/or by double clicking it
and going to the ‘general’ tab.
9. Importing tabular data into QGIS and appending data using a table join
Any tabular data can be imported into QGIS and if it has coordinates can displayed as
a vector and converted to a shape file. The table needs to be in the common csv
(comma separated values) format. If the data is in Excel ‘save as’ and choose csv file
format to create the table in csv. Import this table using the ‘Create layer from a
delimited Text File’ dialog and associate ‘X field’ and ‘Y field’ with the coordinate
data (in this case the CRS is long lat). You also import a table without coordinates by
checking the ‘No geometry’ button. In this screen shot below the ‘X field’ and ‘Y
field’ are the GPS co-ordinates are from a csv file created by the -geotag exiftool
function rather than manually entered but it’s the same action.
Page 16
If there is no geographic data in a table that you want to convert to vector shape file to
be displayed in map project, the coordinates can be added manually. If you dealing
with Ordnance Survey projection data. Create two new columns with names ‘X’ and
‘Y’ in the csv file then add the co-ordinates to each image file row in 1 meter all-
numeric format. A grid reference such as SO456379 is typed as (X) 345600, (Y)
237900. [Column names can be anything, but ‘X’ and ‘Y’ avoids confusion].
This is useful for bringing data created in the years before GPS, or where grid
references have to be added manually for whatever reason.
In the case of a hard copy table you always scan it and use OCR to create a tabular
file.
Vector table joins
A very useful facility is the ability to add tabula data to an existing shape file in your
map project. Say you have an existing tree photo layer in QGIS which just has file
names and maybe data/times but you want to add additional data fields about those
trees (species, girth, height, TPO status etc) which reside in a table with or without
coordinates.
As long you have a column in that table (eg photo file name) which has the same data
as a column in the layer attribute table (known as a common key) you can add all
those table fields to the layer attribute columns once you’ve imported the table as
above.
Open ‘Layer Properties’ > Joins > ‘+’ icon - this brings up the ‘Add vector join’
dialog. Fill in the ‘Join layer’ box (down arrow lists the layers) with the table name (it
can be another vector layer) and then fill in the ‘Join field’ with the common key
column (down arrow lists the layers).
When you OK this dialog the tree photo layer will now have the extra data fields from
your imported table. Save in the usual way.
Page 17
10. A worked example – a ramble from Weobley to Norton Canon:
Here is a worked example of geo-locating photos during a walk from the Castle Green
in Weobley to Norton Canon 14/1/2017. I had a Sony NEX-6 (non-GPS) and the
Garmin GPSMAP 64s switch on but in its case all the time, so no waypoints, just the
automatic track points. The camera time was already synchronised with the GPS:
Copy the photos into the folder & if needed do a bit processing to adjust light levels.
We need to copy the track point file from the GPS into that same folder before we run
the batch file we create in section 6 above.
You also need to ensure that the Garmin GPS driver is installed so your system
recognises it when plugged into the USB port, free from
https://www.garmin.com/en-US/software/express/
Make sure that your QGIS installation is set up with the correct CRS settings:
Settings > Options > CRS check the button ‘enable ‘on the fly’ reprojection by
default’. Under ‘CRS for new layers’ check ‘use a default CRS’ and click the CRS
icon to the right of the box and type 27700 into the ‘Filter’ and you should get ‘OSGB
1936/British National Grid’ Authority ID ‘EPSG:27700’. Click OK on the dialogs.
Page 18
Connect the GPS via the USB cable that came with the unit and it should appear as an
external drive as above, open the ‘GPX’ folder:
There you will see the any waypoint files that you have created (using ‘mark’ and
‘enter’ on the unit) grouped by date. Folders ‘current’ and ‘archive’ contain the track
and route files, these are the GPS points and track lines created automatically every 10
seconds or so by default when the unit is switched on. ‘Current’ is contains a single
‘current.gpx’ for the today and previous track and route files are placed into ‘archive’
with their dates:
The gpx file I want is 14/1/2017, the day of the walk, so I drag that over into the
folder of photos so that the folder of photos has both the .bat and .gpx files as below:
Page 19
Now run the timeshift&geotag.bat file (double click it).
A better alternative workflow which avoids having duplicates of the batch file all over
the place is to have this batch file in one permanent location (could be anywhere) then
‘drag and drop’ one of the photo files in the folder onto the batch file. This will do all
the above and if you want to edit the batch file it will be same for all folders.
By default, ExifTool creates back up files with the extension ‘_original’ although this
can be prevented by adding the -overwrite_original tag just after –geotag
You can see whether the GPS co-ordinates have been successful added to the EXIF
data of the previously geo-unaware photo files from within Windows file explorer by
right clicking a file > properties and opening the ‘details’ dialog, as below:
Now that the photos are geo-tagged they can be imported into QGIS as page 2 above.
To continue the worked example, I will import the GPS track points into QGIS as well
as the photo points. Import vector layer either by pressing CRTL+SHIFT+V, or
through tool bar or by ‘drag & drop’
Page 20
Using the ‘add vector layer’ dialog, browse to the Garmin GPX archive folder and
choose GPX as the file type to import (bottom right of dialog).
It is actually much easier just to drag & drop the required gpx file directly from the
Garmin folder and into the layer pane:
!Don’t be tempted to use the ‘GPS Tools’ plugin - it is useless and unnecessary.
Unfortunately it cannot be uninstalled as its now part of the ‘core plugins’ that come
pre-installed with QGIS – disable it by unchecking its box in the plugins dialog.
The new(ish) Garmin GPSMAP 64 series, with its ‘drag and drop’ ease of connection
to PCs and laptops, is a great improvement on earlier units which could be a pain to
connect and/or process their gpx files. If you do have an earlier Garmin by far the best
way of importing waypoints and track lines is to download the free GPS utility from:
http://www.dnr.state.mn.us/mis/gis/DNRGPS/DNRGPS.html
This piece of software has been made available free by the Minnesota Department of
Natural Resources. Latest release is 6.1.0.6. Chose any of the ‘ArcMap’ versions. It
connects to units, converts GPS data to shape files, transforms CRS and other
functions.
Page 21
The DNRGPS utility is so user friendly that you may even prefer to use it instead of
the GPX import and conversion to shape file facility in QGIS that I am describing.
When the gpx file imports the ‘select vector layers to add..’ dialog pops up which lists
all the possible route, track and waypoint data. For track points you only need the
‘track_points’ data, and if only importing waypoints you just need ‘waypoints’ option.
[Ignore the ‘0’s under ‘number of features’ no idea why it always says that.]
These are the track points imported with a background of a raster map in OSGB CRS.
This file of gpx points still resides inside the GPS unit and is not on your system. Also
its in longitude and latitude WGS 84 and is being re-projected on the fly by QGIS.
At walking speed the individual track points are quite close.
To make this vector layer useable, editable and stored on your system we must
convert it into a shape file: right click on the layer ‘save as’ shape file, select CRS as
OSGB (27700) and browse to the required folder location and give it a name.
Page 22
Ths new vector layer is produced appears identical to the GPX file except that it is in
OSGB projection and is a shape file residing on your system not in the GPS.
We can now delete the GPX vector layer from QGIS (won’t effect the file on the GPS
unit), disconnect the GPS unit and look at the data table of the new shape file layer by
clicking the table icon:
We only need the ‘time’ field so we can delete all other data fields. To do this we
must put the layer into ‘edit’ mode by clicking in the ‘pencil’ icon either in the table
dialog or on the tool bar (CTRL + E). Click on the ‘Delete fields’ icon or quick key
CRTL+L (to add a field CTRL+W). Since we are deleting all fields except one, its
quicker select all fields (CRTL+A) and then unselect the ‘time’ field:
Page 23
Now that we only have the ‘time’ field it is a useful exercise to learn to use the
powerful ‘field calculator’ which can create new fields and manipulate data.
We will create a new field consisting of the time of data in hrs:min:sec format
extracted from the existing ‘time’ field which includes data as well as time. We will
then display each time as a label next to each track point – this will show the
frequency with which the GPS creates a track point in its automatic default mode.
We will also be able to see how accurate are the photo points when we import the
locations of the photos geotagged by ExifTool. With the table open and in edit mode
the ‘field calculator’ is selected by the abacus icon or (better) CRTL+ i :
We create a new field called ‘hr_min_sec’ to be formatted as a text string (rather than
a numeric), give the ‘output length’ sufficient number of characters (say 25).
We need to isolate the 8 character string within date time string from the GPS unit, so
type in the above script. The central panel has a convenient list of functions, fields and
operators and in the right panel explains what they do. This is very helpful for
formulating more complex scripts.
The results of the script are immediately displayed in the ‘output preview’ (square box
above) so we can edit the script if necessary. Pressing OK, we have what we want:
It also shows the number of track points in the table (882).
Page 24
At present we have the OS raster map in CRS 27700 but lets have the track lines
displayed against Bing maps aerial photography.
Bing and Google aerial imagery have projections in WGS 84 pseudo Mercator
(EPSG:3857) and unlike vector data QGIS does not have the ability to re-project
aerial imagery delivered from a remote server to another CRS on the fly, so
attempting to overlay such an aerial raster layer onto another raster in a different
projection will not work.
So we will start a new QGIS project, import the track point shape file we created
which is in OSGB CRS and note that our QGIS has OSGB CRS by default:
Double clicking in any layer will bring up the ‘layer properties’ dialog in which the
‘General’ tab will show the essential attributes: vector file name, location on the
system and CRS. Note the projection 27700 (OSGB) at the bottom right.
To add aerial imagery as background raster we will install the ‘OpenLayers’ plugin.
All QGIS plugins are held online in the plugins repository to which QGIS connects
when you want a plugin not already installed. Selecting ‘All’ accesses the total 758 (as
of Nov 2017) plugins so type in the name (or partial name) in the Search box:
Page 25
When installed the OpenLayers plugins creates a number of options in the ‘Web’ tab
on the tool bar: We will select Bing Maps > Bing Aerial.
Note that although both the track points layer and the QGIS default CRS are both
OSGB (EPSG:27700) when the OpenLayers plugins connects to the Bing aerial
remote servers and starts to download the tiles which are to make up the aerial
background raster, a warning note briefly pops up telling you that it cannot be
projected. However QGIS then alters the projection of the project to EPSG:3857 and
re-projects the OSGB vector layer accordingly so everything is in the right place. But
note the coordinate display is no longer in OS grid EPSG:27700 but EPSG:3857.
Now label each track point with the time in hr:min:sec using the Label dialog in which
we select which data field the labelling text should come from, colour, font etc.
Page 26
We now import the photo points (orange) from the now geotagged photos from the
Weobley walk using the same method as described in section 2 page 1 above.
One interesting point about the ExifTool –geotag function is that is doesn’t just assign
the photo to the nearest track point but interpolates the time between track points to
obtain the best fit to the photo time stamp and its location between track points.
Page 27
Opening the table for the photo points layer shows the path to photo folder, the file
name and the GPS date and time that we used the geotag plugin to extract.
To make the numbering of the photos less cluttered we create a new field ‘PhotoNo’
with just the last 3 numbers of the photo file name using the same procedure with the
‘Field calculator’ (CRTL + i) as we did on page 13 to extract a sub-string of 3 digits
from the ‘Filename’ field:
We now call up the ‘Event browser’ as we did on page 4 checking that the file path is
‘absolute’ under the ‘options’ tab, so we can visually step our way through the walk.