Using QField Cloud Sync¶
How does it work¶
QField Cloud Project contain .gpkg files, which are the equivalent of a database. qf-sync.sh is used to keep in the synchronization between a Quick Fields's project .gpkg file and a database. It does that by monitoring for changes in project .gpkg file, finding the differences and applies them to database, using geodiff tool.
Configuration files¶
Synchronization script needs a configuration file holding information for QField Cloud and PostGIS database. Here's a sample configuration:
# script settings
sleep_time=60
single_run='true'
force_init='true'
data_dir="${HOME}/data/survey"
# QField Cloud settings
qf_user='john'
qf_pass='123456'
qf_url='https://qf1.example.com/api/v1/'
qf_proj_id='e59842d8-5517-4f2a-ae2c-d149b118fc17'
qf_gpkg='Survey_points'
# database settings
pg_host='localhost'
pg_port='5432'
pg_user='john'
pg_pass='123456'
pg_dbname='survey'
pg_schema='survey_data'
You must put all of your configuration files in one directory (ex. $HOME/qfsync), if you want to use the systemd service.
Script usage on command line¶
To run the script, pass configuration file, as first parameter. The script will run forever, unless the single_run flag is set in configuration file.
To stop the script, you can use Ctrl-C.Script usage as a service¶
If you have installed the systemd service file, and set path to configuration files, you can do synchronization like this
This command will run qf-sync.sh as a background service and use settings from survey.ini file.