top of page
  • Writer's pictureJessica Kane

Using QGIS and QField for Field Data Collection

Updated: Jun 3, 2022

By Jessica Kane


About QGIS and QField

QGIS is an open source desktop GIS which means it is free to use, modify and redistribute. It allows users to view and edit vector and raster data in a variety of file formats and databases. Its robust set of tools allows users to perform geoprocessing functions, spatial analyses and style beautiful maps. QGIS includes a Python environment called PyQGIS which allows for the scripting of geospatial processes. As an open source project, additional plugins are being built all the time which extend the functionality that QGIS provides out-of-the-box.

In March 2019 QField 1.0 was released. QField is an open source mobile (Android) application that allows you to edit QGIS projects on a mobile device. It is built with the QGIS rendering engine so your QGIS project (including symbology) will look exactly the same in QField. It supports most of the formats that QGIS supports including shapefiles and PostGIS databases and works fully when offline. QField functionality includes feature digitizing, geometry and attributes editing, attribute search, forms customizable through QGIS, GPS support, and camera integration. QField supports creating and editing points, lines and polygons. You can also configure snapping in QGIS and use that in QField. A plugin for QGIS called QFieldSync makes packaging QGIS projects for QField a synch.


Set-Up

Download QGIS and Set Up Project

  1. Open QGIS and create a new project:

3. Add your data and basemap and adjust symbology. See the Resources section of this document for QGIS tutorials.

PLEASE NOTE: You will want to make sure your data layers are saved with the same CRS as your project in order for them to show up properly in QField. If you want to use a basemap, it is best to set your project CRS to EPSG: 3857 (WGS 84/Pseudo-Mercator) since popular basemaps you can access through QuickMapServices in QGIS use this CRS.


Set Searchable Fields

In order to be able to search a layer by a particular field in QField, you need to identify that field in QGIS.


4. Double click on the layer in the Layers panel on the left to open the Layer Properties dialog.

5. On the Display tab select the field you want to be able to search on in the Display Name.

PLEASE NOTE: The field name cannot have spaces in it. Otherwise it will not work in QField.

6. Click Apply


PLEASE NOTE: If there are layers that are for display purposes only, you can make sure they don’t show up in search results in QField.

  • Go to Project > Properties to open the Project Properties dialog:

  • Click on Data Sources and uncheck the layers in the Identifiable column that you do not want to view attributes for in QField. Uncheck Searchable if you don’t want that layer to show up in search in QField. You can also set layers as Read-Only.

  • Click Apply

Set Up Forms

There are powerful tools in QGIS that allow you to set up constraints on editing attributes in QField such as dropdowns, data formats (e.g. date), and required fields.


7. To set up required fields:

  • Double click on the layer you wish to edit in QField to open the Layer Properties dialog.

  • Click on Attributes Form and select the field you are interested in.

  • In the Constraints section:

    • Set the Expression to “YOUR FIELD NAME” IS NOT NULL

    • Set the Expression description to the text that you want to show in QField to let the user know the field is required (e.g. SiteID is required)

    • Check the box by Enforce expression constraint

  • Click Apply

8. To set up an auto incrementing ID field:

  • Double click on the layer you wish to edit in QField to open the Layer Properties dialog.

  • Click on Attributes Form and select the field you are interested in.

  • In the General section, uncheck Editable. This will prevent the user from editing this value in QField.

  • In the Defaults section, set the Default value to: maximum(“YOUR ID FIELD NAME”) + 1

  • Check the Preview to make sure it looks correct.


  • Click Apply

9. To set up dropdowns:

  • Create a .csv file with two columns labeled Value and Description. In the Value column enter in integers. In the Description column enter in the text for the items you want the user to see in the dropdown.

    • PLEASE NOTE: If you are working with legacy data that has been stored as you want the user to see (e.g. “Phragmites” instead of “1”), put the same thing in both Value and Description columsn (e.g. “Phragmites” in both)

  • Double click on the layer you wish to edit in QField to open the Layer Properties dialog.

  • Click on Attributes Form and select the field you are interested in.

  • To create a dropdown for that field, under Widget Type select Value Map.

  • Click Load Data from CSV File and navigation to the .csv file you created. Review the table in the dialog to make sure the values looks as you’d like.

  • Click on Add “NULL” value if you’d like the user to be able to select a null value.

  • Click Apply

    • PLEASE NOTE: A Widget Type of Unique Values can be used in QGIS to create dropdowns; however this Widget Type is not supported in QField.

Adding Photos

You can take photos with QField and have them be associated with a particular feature. You need to adjust this in QGIS to make photos available in QField.


10. Double click on the layer you with to edit in QField to open the Layer Properties dialog.

11. Click on Attributes Form and select the field you want to attach photos to.

12. In the Widget Type section select Attachment.

13. In the Path section, check Relative paths and select Relative to project path

14. Click Apply


15. In the Actions section click the Add a new action button:


16. In the Edit Action pop-up, set the Type to Open. Choose a Description and Short Name that you like.

17. Make sure Feature Scope and Canvas are checked.

18. In the Action Text type the following: [% “NAME OF THE FIELD WHERE YOUR PHOTO IS” %]

19. Click OK

20. Click Apply


Install the QFieldSync Plugin

21. In QGIS go to Plugins > Manage and Install Plugins…


22. Search for ‘qfield’, select ‘QField Sync’ and click Install Plugin.


Configure QFieldSync

When you configure QFieldSync, it stores the configuration in the QGIS project file. So you only need to configure it once (although if you add more layers later you’ll want to adjust their configuration).


23. Click on Plugins > QFieldSync > Project Configuration


24. In the Layers section, configure your layers (for further information see the link for QFieldSync in the Resources section of this document):

  • Select offline editing for the layers that you wish to edit on your mobile device.

  • Select remove if you don’t want the layer available on your mobile device.

    • PLEASE NOTE: Select this option for your basemap as you will be configuring that in the bottom portion of the pop-up.

  • Select copy for the file-based layers (e.g. .shp) you want to show up on your mobile device, but you do not want to edit.

  • Select no action for the non-file-based layers (e.g. PostGIS) you want to show up on your mobile device, but you do not want to edit.

25. In the Base map section, configure your base map (for further information see the link for QFieldSync in the Resources section of this document):

  • For the purpose of this demonstration, we will select Single Layer and will select the Google Satellite Hybrid raster layer as our basemap.


26. In the Offline editing section, check Only copy features in area of interest. This will mean that only features which are within the extent of the map canvas at packaging time will be copied to the offline editing working copy.


27. Click on Plugins > QFieldSync > Preferences


28. Select or type the directories where you want your QFieldSync import and export files to be stored (or leave the default paths):

Package Project for QField

29. Click on Plugins > QFieldSync > Package for QField


30. Select a different Export Directory, if desired.

31. Adjust the map in QGIS so that the extent you want available in the mobile device is showing

32. Click Create.


33. PLEASE NOTE: It may take a few minutes to package the project for QField. When it is complete, you will see a message at the top of the map in QGIS:

Message at the top of the map in QGIS indicates that the project has been packaged.

Install QField

34. On your Android device, go to the Google Play Store and search for ‘QField’

35. Install ‘QField for QGIS’


Transfer Package to Mobile Device

36. Plug your mobile device into your computer (e.g. use a USB cord). If prompted, make sure to Allow access to device data on your mobile device.

PLEASE NOTE: Depending on your mobile device, you may need to take other actions to allow the file transfer from your computer to your mobile device. For example, the Pixel requires you to click a notification and then select File Transfer

37. On your computer, navigate to the QField package you created in QGIS (e.g. C:\Users\jeska\QField\export\Invasives_demo) and copy the folder:


Collect Data in QField

  1. Open QField on your mobile device. If this is the first time you are opening a package in QField, you will see this screen:

Mobile screen shows instructions for starting a new QField project.

2. Tap on the green map icon. You will be prompted to Allow QField to have access to the files on your device.

PLEASE NOTE: If you do not see the screen above, but see a blank screen, click the bars in the upper left, then click on the gear icon and tap Open Project.


3. You will see a screen like below. Tap on Internal Storage and navigate to the QField package to open it in QField.


4. You should now see your QGIS project in QField and can begin editing data:

A map appears in the QField map with the points of features from QGIS shown.

5. For general navigation in the QField application and instructions on how to edit data, view the QField User Guide.

PLEASE NOTE: QField uses the Android device’s back button to close menus like the attribute menu.


Synchronize Back to QGIS Data Source

Transfer QField Package Back to Computer

1. When you have completed your data collection, connect your mobile device to your computer with a USB cord. 2. Through your computer’s file explorer, copy the QField package folder (e.g. Invasives_demo) from the mobile device (e.g. This PC\Samsung Galaxy S7\Phone\Android\data\ch.opengis.qfield\files) to the directory you set in your QFieldSync preferences for import (e.g. C:\Users\jeska\QField\import\) PLEASE NOTE: You may have to create this folder. 3. In QGIS navigate to Plugins > QFieldSync > Synchronize from QField


4. Select the project folder in the pop-up and click Synchronize:

Transfer Photos

5. If you took photos in the field, there will be a folder in your QField package folder (e.g. DCIM). Copy this folder from your import folder (e.g. C:\Users\jeska\QField\import\Invasives_demo) to the folder where your QGIS project is saved.

PLEASE NOTE: If there is already a photo folder (e.g. DCIM) in the same folder where your QGIS project is saved, you will want to copy just the new photos over into the image folder, instead of replacing it so that you don’t overwrite previous photos.

6. In your QGIS project you should be able to see any new data that you entered in the field. In order to view the photos you took, click on the black arrow on the green Run feature action button in the QGIS toolbar and select the open action you created earlier (e.g. Open file).


7. Your cursor will change to a plus sign. Click on a feature with a photo attached and the photo will open.

Clicking on a feature that has a photo opens the photo in a new window.

Items to Note

Concurrent Editing & Synchronization

When using offline editing mode for a layer in the QFieldSync configuration, a user in the office can make changes to the data in the QGIS project that persist when you upload new data from a user in the field. Multiple people can be gathering data points in the field and then syncing with QFieldSync as well. However, there is no conflict resolution so if two field users update the same feature, the updates from the most recently uploaded user data will overwrite the previous one.

There is also the option to store your data in a centralized database (such as PostgreSQL/PostGIS) on a server that is accessible through an internet connection (the QField package file still needs to physically be stored on the Android device). This allows multiple people to be editing data and seeing others’ edits in real time, as long as they have connectivity.

There is a plan for future releases of QField to have a hybrid mode that can cache the data when offline and then automatically sync when connectivity is restored. In addition, cloud synchronization functionality is planned so that you will be able to seamlessly manage your project online and have it automatically deployed to your devices.

Accuracy

Data collected through QField will be as accurate as the GPS information that the Android operating system is delivering to it. This can be as simple as using a cellphone or QField can be used on a tablet with Bluetooth connected to a high-resolution differential GPS, resulting in much more accurate data locations. QField natively listens to the Android location services so it can take advantage of the best location provided by external devices.


Resources

QGIS

QField

PyQGIS


Conclusion

If you have more questions or want help on your next project, let us know. Email us at contact@line-45.com or call us at (833) 254-6345.


You can find a .pdf version of this article here:

QGIS-QField
.pdf
Download PDF • 1.75MB

Special thanks to Huron Pines for letting us use their invasive species data for this demonstration.

17,033 views0 comments

Recent Posts

See All
shutterstock_1935178568.jpg

TRANSFORM YOUR BUSINESS

READY TO GET STARTED?

Tell us about your business and take the first step toward optimized operations.

Got questions? We have the answers here.

LINE 45, LLC
P.O. Box 153
Gaylord, MI 49734

T: 833-254-6345

E: contact@line-45.com

© 2024 LINE 45, LLC. |  PRIVACY

Sign up for the latest from LINE 45.

STAY UPDATED.

We won't share your email with anyone else. Unsubscribe anytime.

Thanks for subscribing!

bottom of page