In this quick start guide you will set up synchronization between your PostGIS database and new Mergin Maps project.
- PostGIS database - details for DB setup
- Docker engine
If you are on Windows and do not have Docker installed, you can consider installing it in Windows Subsystem for Linux.
Create a new schema (sync_data
) in your postgis database (here dbsync
) with few points.
You can simply use this file and run:
$ psql -h localhost -d dbsync -U postgres -f sample_data/test_data.sql
Go to Mergin Maps website and create a new blank project (and call it e.g. db-sync
):
Once the project page opens, you should see there are not any files there:
and your full project name for later will be <workspace>/<project-name>
, e.g. john/db-sync
Prepare config.yaml
configuration file, and replace <username>
, <password>
and <workspace>
with the real values (and also update database connection's username/password):
mergin:
url: https://app.merginmaps.com
username: <username>
password: <password>
init_from: db
connections:
- driver: postgres
conn_info: "host=localhost dbname=dbsync user=postgres password=mysecretpassword"
modified: sync_data
base: sync_data_base
mergin_project: <workspace>/db-sync
sync_file: sync_db.gpkg
daemon:
sleep_time: 10
Run this Docker command (see installation guide for alternative options how to run db-sync):
docker run --network host -it -v ${PWD}:/settings lutraconsulting/mergin-db-sync /settings/config.yaml
and you should see a new GeoPackage file in your Mergin Maps project.
To be able to use the synchronized GeoPackage as a survey layer:
- Download the generated gpkg file with Mergin Maps plugin for QGIS to an empty folder.
- Open it in QGIS
- Style it (if you wish)
- Save the QGIS project on the same folder as the downloaded gpkg file
- Upload the QGIS project to your Mergin Maps project, using the Synchronise Mergin Maps project button
The QGIS and GeoPackage files will be a valid Mergin Maps project ready for surveying. Read more about QGIS project configuration on Mergin Maps and Mergin Maps Input documentations.
In order to stop syncing simply stop docker container.