FINAL REPORT ON CHALLENGE #10: Integrating QField with the Innovation Hub
Name of mentor(s): František Zadražil
Number of participants: 4
Challenge no.10 FINAL REPORT [PDF, 1,5MB]
Geodata processing workflow tools combined to a complex Digital Innovation Hub (DIH) solution have been developed in the last few years. They offer anyone a chance to publish and share data with coworkers or a large community. All those tools are based on open source technologies and are designed to allow working with the data on desktop and web platforms. Components included in the workflow are (Fig. 1):
- HSLayers – web mapping framework https://ng.hslayers.or
- QGIS Layman plugin – desktop client for geodata publishing https://plugins.qgis.org/plugins/Layman/
- Layman – geodata publishing server https://github.com/LayerManager/layman
- Micka – metadata catalogue https://micka.bnhelp.cz
- Wagtail – content management system which encapsulates all the above components at the level of authentication via OAuth2 standard https://wagtail.org
A mobile application has been introduced to the workflow recently in the form of QField (https://qfield.org) and its derivatives. QField is based on the same libraries as QGIS Desktop is and targets at the in field work and collecting of data.
It is possible to publish single layers or whole map projects (compositions) through Layman. This challenge deals with the latter.
All the mentioned components use an unified map composition schema to describe the map completely (https://github.com/hslayers/map-compositions). QField (and QGIS), on the other hand, uses its proprietary format for map projects and there are two ways to synchronize map projects from QGIS to QField. Copy the project directly from computer to the mobile phone or through the QFieldCloud (for simplicity also referenced only as Cloud later in this document).
Main goal of the challenge was to add an option to publish existing Layman map compositions to the QFieldCloud and make them available for the mobile devices via the QField app.
Figure 1. Architecture of the Innovation Hub solution
The solution of the challenge has been created in several phases.
Analysis of the problem
Initial idea of incorporating QFieldCloud into the data processing presented a new architectural layer of the whole system. Ideal component to communicate with the Cloud would be Layman as that is the responsible party for the data publishing. But extending Layman was not possible at the time span of the hackathon due to rather complex deployment so our team has decided to go with a pilot implementation directly inside the QGIS Layman plugin (Fig. 2), which is easily extensible and can be quickly tested. The Cloud is also still in its beta version and is prone to change in the upcoming weeks and months. As soon as the “map to cloud” publishing becomes stable enough, the implementation could be moved from client (QGIS) to server (Layman).
Figure 2. DIH architecture extended by the QFieldCloud component.
Analysis of the QFieldCloud API
QFieldCloud comes with an API that allows us to work with most of the parts of its ecosystem, first of all with the map projects. The interface of the API is documented using Swagger specification and can be found at https://app.qfield.cloud/swagger/. Important parts of the API have been identified including the methods for authentication and uploading map projects.
Proof of concept implementation
We used the Postman Client (https://www.postman.com/product/rest-client/) for the testing of QFieldCloud API and detailed implementation analysis that was needed for the last stage. The output of this was a step by step description of the future implementation with a complete list of needed Cloud API methods and the way how to use them.
Implementation as a part of the QGIS Layman plugin
The existing QGIS Layman plugin has been extended by a new option for the map composition (or just a “map”). Once the user creates a map using the plugin tools, a new button “Export to QField” is available.
The user must enter the credentials for his/her QFieldCloud account (this is also for the future work as described below) and is then presented with the export form where can publish the map as a new Cloud project or add the content to an already existing one (Fig. 3).
The map can be published publicly as a community project (which means everyone in the QField community can find and see it) or as a private project. Private maps can later be shared with specific users or organizations.
Figure 3. Export map to Cloud form in the QGIS Layman plugin
Once the map is exported, it is immediately available in the Cloud and can be found in the community or private map projects in the QField mobile app (Fig. 4).
Figure 4. List of map projects and a sample map in the QField mobile app.
Cooperation with other Challenges
The whole geo-data management system was closely connected to other challenges of the hackathon as many used it to publish their results in the form of maps. Challenges 9 and 12 were completely built upon the basis of this system and the new QField integration was presented as a part of its training.
Challenge #9 A new social space for geographic information sharing and education
Challenge #12 Building a map based social space for Africa
Video recording from the SmartAfriHub Training (Part 2)
FINDINGS & CONCLUSION
The team of this challenge succeeded in the main goal. That was to investigate the ways how to integrate QField and its Cloud to the existing Hub architecture. Working tool have been developed which enables any user to publish his or her maps to the QFieldCloud and access it through the mobile devices.
The new tool is integrated into the existing QGIS Layman plugin so there is no need to install any new plugins or extensions.
A road map of the next development has also been devised that will include integration of QFieldCloud to the Hub infrastructure.
Another ancillary tasks have been done beyond the intended scope of the challenge. The way how to integrate Wagtail CMS and the whole DIH with the Google authentication mechanism was investigated and tested and the map widget for the CMS has been extended to allow more user friendly administration of the maps inserted into the web pages of the portal.
The biggest challenge remains the authentication, or to be more specific, to ensure Single Sign On, so the user does not need to create more than one account to work with all the tools of the geo-data workflow including mobile apps.
That will require us to host the QFieldCloud at our server and develop a derivative QField app to be able to connect to our own instance of Cloud (Fig. 5). Even better and preferable approach would be to contribute directly to the QField app development and implement the cloud endpoint settings so the user could select to which cloud instance the app will connect.
As stated before, another step should be to move the implementation from the QGIS plugin to the Layman server component so other clients could easily do the cloud publishing without the need to implement it itself.
Figure 5. Future form of the Hub architecture with QFieldCloud integrated in the Wagtail CMS ecosystem.