The original version of this document is located at https://docs.qfield.org/get-started/tutorials/my-first-project
This page will go through a step by step example of how to prepare a simple QField project containing a points layer, a line layer and a basemap.
It will include the configuration of a simple attribute form and the styling of the feature layer.
Used case
Hi, my name is Maya Mielena, I am a retired GIS Specialist and I will show you how to prepare a simple QGIS project so that you can use it inside the QField application
We will create a GeoPackage (.gpkg) containing a point layer and a line layer.
This will allow you to go out into nature and record your personal points of interests and track yourself using the line layer.
Let’s get started!
Add a basemap of your choice to the project.
We will now locate our area of interest.
There exists a very useful QGIS plugin called OSM Place Search, which allows you to browse through the different place features available in the OpenStreetMap data.
Add the following:
Attribute | Data type |
---|---|
Name | string |
Entrydate | date |
Visit | Boolean |
Category | string — We will use this to create a dropdown list from which you can select the point of interest category |
Attachment | string |
Notes | string |
Adding a Line layer
We will create another layer within the GeoPackage corresponding to a line layer.
You can use it to track yourself when going into the field.
Add the following fields:
Attribute | Data type |
---|---|
Name | string |
Date | date |
Saving the temporary layer in GeoPackage
Remember that we have added our area of interest as a temporary layer meaning that after closing the project we will not be able to access the layer anymore.
Therefore, we will save the layer within the just newly created GeoPackage.
Now we have all the essential data in the QGIS project that we need for the data collection.
However, in order to have a well structured form we need to configure the attribute form, via the file properties.
Select Drag and Drop Designer from the dropdown.
From here you can control the appearance of your form.
We do not need to edit the fid field.
QGIS creates this for every GeoPackage by default.
Remove the fid field from the visible fields by pressing the red minus on the window
For the field Visit you can just change the Alias name to something more readable like “Worth the visit?”
The Category field is a bit more interesting.
Maya wants to have a dropdown list from which she can select what type of location it is.
Luckily, there is a widget type called value map, where we can enter some categories.
Open the widget display for the Category field and change the widget type to Value map
Enter some relevant categories to the value map
Key | Description |
---|---|
Photo_point | Photo point |
Restaurant | Good Restaurant |
Accommodation | Hotel |
Attraction | Tourist Spot |
Nature | Nature Spot |
Other | Other |
Change the widget type of the Attachment field to Attachment.
This will save the path of the where the image is stored.
You can also set the preferred document type under the integrated file viewer.
This will not only display the attachment directly in the form, but it will also set the default attachment type to the one you have selected.
NOTE: Change the path to relative path so that it is relative to the project folder that you are working in and not the absolute path.
For the Notes field you can just use the widget type to Text Edit.
Fantastic, we have successfully configured the form of the PoI layer.
Maya wants to track herself immediately when starting to walk rather than having to set it up manually. Luckily this can be done by setting up the tracking session in the QGIS project file
Enable the Tracking session and set the required parameter.
You can decide whether you want to add vertices based on a temporal value or based on distance.
We will use the latter option for this purpose.
You will configure the attribute form in such a way that it automatically populates the attribute fields when starting a new session.
Furthermore, you will hide the attribute form so that the tracking just runs in the background.
Direct to the Attribute Form
fid
: Remove this fieldName
: Set a default value to ‘@cloud_username’Entrydate
: Set a default value to ‘now()’Maya does not want to copy the QGIS project manually to her mobile device.
Instead she wants to make use of QFieldCloud, which allows her to simply synchronize her QGIS project into the cloud and then download it via the cloud to her smartphone.
For this she has downloaded the QFieldSync Plugin, which she describes as the portal to QFieldCloud.
In fact, it is a plugin that can be used to package and transform a QGIS project into a readable format that QField can read.
Search for QFieldSync and install it
In QGIS a new toolbar should appear
Now it is time to create your first QFieldCloudProject
QField/cloud
directory.If everything is alright, a new window will appear with the message *The locally stored cloud project is already synchronized with QFieldCloud, no action is required.
Congratulations!!! you have successfully created your first project and are now ready to map with QField
Click on QFieldCloud Projects and sign in with the same credentials as before.
Your project should already be available.
Now you are good to go and can start mapping.
It will ask you to turn on your location in case you have not done that yet.
Remember that we have set up the tracking layer.
Maya is very happy, she will use this project very frequently as she loves nature and wants to spend every spare minute that she has outside, like all of the OPENGIS.ch team. We hope that you find this useful and will start to use QField and make use of QFieldCloud.