Linking Photos and Creating FOV Cones with Photos in QGIS

Linking Photos and Creating FOV Cones with Photos in QGIS

Recently, Kurt Menke from Bird’s Eye View GIS came to Spatial Networks’ HQ office and provided us with a three-day training course on all things QGIS. While I have dabbled with QGIS in the past when attempting to assist Fulcrum users, I had never really spent a lot of time to take a deep dive into QGIS. When the opportunity arose I was eager to attend the course.

Going through the class, I thought about what I could write about that could be applicable for Fulcrum users. Originally, I planned on writing this post on creating relations between layers within QGIS as a way of showing how users could link their child data from repeatable sections back to their parent. However, I found out I was about 5 years too late as Coleman had already written about this long ago. While that post was written for QGIS 2.2 and could use a refresh, for the most part, his article is still applicable in the latest version of QGIS.

Instead, I would like to show how you can link photos to attributes within a layer and also leverage the photo EXIF data to create field-of-view (FOV) cones within QGIS 3.6.

Linking and viewing photos in QGIS

Creating a layer for photos

Working off of the same dataset that Coleman used, the parent data are the parks and the child data are the features in each of the parks. From here, we will use the photos themselves to create a new layer within QGIS. To do this:

  1. Open into the processing toolbox by clicking on the gear icon in the project toolbar.

  2. Once you have the processing toolbox open, locate the Import geotagged photos algorithm. You can use the search box at the top or locate it within the Vector Creation section.

    Linking Photos and Creating VOF Cones with Photos in QGIS

  3. Within the Import Geotagged Photos window that opens, select the folder where the photos are located on your computer for the Input folder field.

  4. In the Photos field, you can either leave this blank and create a temporary layer or create a new layer. In this case, I have created a new layer within the GeoPackage file with the rest of the layers in this project.

  5. Run the process.

    Linking Photos and Creating VOF Cones with Photos in QGIS

Linking photos to the photo layers

After the algorithm has run, you should notice a new layer with the name you set. Next we will want to link the photos to the newly created photo layer. To do this:

  1. Right-click on the layer and select properties.

  2. Select the Form icon on the right-side menu.

  3. Select Photo within the Fields’ drilldown.

  4. For the Widget Type, select Attachment.

  5. Select the folder where the photos are located on your computer.

    Linking Photos and Creating VOF Cones with Photos in QGIS

  6. You may need to scroll down within the Widget Type section, select Image for the Type under the Integrated Document Viewer subsection.

  7. Optional: You can also check the Use a hyperlink for document path (read-only) option. This will add a hyperlink allowing you to open the original photo in on your computer’s photo viewer.

  8. Select OK to create the link.

    Linking Photos and Creating VOF Cones with Photos in QGIS

Viewing photos from photo layers

Now that the photos are linked to the photos layer, to view the photos:

  1. We can highlight the photo layer by clicking on it.

  2. Then enable the Identify Features option on the Attributes Toolbar. Then you can select a photo point on the map to view the attributes.

  3. Within the Identify Results window that opens when you click on a photo point, you can select the View Form Features button to view the photos.

  4. Optional: Clicking on the hyperlink above the photo will open the original photo file.

    Linking Photos and Creating VOF Cones with Photos in QGIS

Adding a FOV Cone

If you would like to take this a step further, you can also add a FOV cone to the photo pins in QGIS to see the direction that the photo was taken in. This can be helpful in seeing which way the photo was taken on the map.

Adding SVG Marker

Optionally, you can change the photo pin to a SVG marker, like a camera and also set the rotation to the direction field in the attribute table. To do this:

  1. Select the Layer Styling Panel icon in the layers window.

  2. Within the Layer Styling Panel, select the photos layer.

  3. Select the “Simple Marker” (SVG marker in the screenshot).

  4. Change Symbol layer type from Simple Marker to SVG marker.

  5. Locate and select the SVG icon you would like to use using the SVG Groups and SVG Image options.

  6. Set the Size, Fill Color, Stroke Color, and Stroke Width you would like to use.

  7. To set the rotation to the direction, click on the Data Define Override icon to the right of the rotation field, then within the field type dropdown select the direction field.

  8. Within the Layer Rendering section, it may be a good idea to set the Layer’s Blending mode to Multiply. This will allow you to see through the marker.

    Linking Photos and Creating VOF Cones with Photos in QGIS

Creating the FOV Cone

Now that we have the pin marker set to a camera icon we can create the FOV cone. To do this:

  1. Select the “+” icon to create another symbol layer. Then highlight this symbol layer.

  2. Change Symbol layer type from Simple Marker to Geometry generator.

  3. Within the code box, use the function wedge_buffer($geometry, "direction", 45, .0001, 0). You will likely need to play around with the second number (the outer radius) depending on the CRS the layer is in and your use case. I found .0001 to be pretty good for my use case in WGS 84.

  4. Within the Layer Rendering section, it may be a good idea to set the Layer’s Blending mode to “Multiply”.

  5. If you wish to get a little fancy, you can also use a “shapeburst fill” for the symbol layer type nested within the geometry generator section.

    Linking Photos and Creating VOF Cones with Photos in QGIS

You can now pan around and view the direction that the photos are taken without having to view the attribute data directly. One thing to note is that if there is no direction data contained within the photo’s EXIF data then the camera icon will face north and there will be no FOV cone. In the screenshot below, you can see quite a few photos where the direction data was not populated by the camera/device that was used to capture the photos.
Park inventory photo

If you are interested in learning more tricks like this I would highly recommend picking up the book that Kurt used during our course called Discover QGIS 3.X. We barely scratched the surface of its contents and it is well written and easy to follow along when doing exercises on your own.

Fulcrum is a data collection platform that enables organizations to reduce costs, access critical data in real time, and improve decision making at every level. With Fulcrum, you can create custom apps using our simple drag-and-drop builder to turn your paper documents into digital forms that your field teams can quickly complete on mobile devices.

About the author

Alex is Fulcrum’s support manager, and works with users to make sure they’re getting the most out of Fulcrum.

Subscribe via Email for updates

Get started with Fulcrum today

Try it FREE