How to connect PostGIS and Mergin Maps

See how you can leverage Mergin Maps platform API to sync between QGIS and PostgreSQL/PostGIS database by Mergin-DB-Sync tool.
We follow quick start available on github.com/MerginMaps/mergin-...
1) Setup PG container
- curl raw.githubusercontent.com/Mer... -o test_data.sql
- docker run --name some-postgis -v $(pwd):/opt/hostdata -e POSTGRES_PASSWORD=mysecretpassword -p 5432:5432 -d postgis/postgis
- docker exec -ti some-postgis psql -U postgres -c "CREATE DATABASE dbsync OWNER postgres"
- docker exec -ti some-postgis psql -U postgres -d dbsync -c "CREATE EXTENSION postgis;"
- docker exec -ti some-postgis psql -U postgres -d dbsync -f /opt/hostdata/test_data.sql
2) create config file
- curl raw.githubusercontent.com/Mer... -o config.yaml
- cat config.yaml
mergin:
url: app.merginmaps.com
username: REPLACE_your_username
password: REPLACE_your_password
init_from: db
connections:
- driver: postgres
conn_info: "host=127.0.0.1 dbname=dbsync user=postgres password=mysecretpassword"
modified: sync_data
base: sync_data_base
mergin_project: REPLACE_your_workspace/REPLACE_your_project_name
sync_file: data.gpkg
daemon:
sleep_time: 10
3) create blank project on app.merginmaps.com
4) start deamon
- docker run --name mergin_db_sync -it --network="host" -v $(pwd):/settings lutraconsulting/mergin-db-sync:latest /settings/config.yaml
Need support with more complicated setups?
- merginmaps.com/community/join
- merginmaps.com/support
See more: merginmaps.com

Пікірлер: 10

  • @joaquinurruti2628
    @joaquinurruti2628 Жыл бұрын

    Hello! This is fantastic thank you! One question: For a database running in AWS DB Sync is installed and runs every 10s in the server? or do I have to install it locally on the machine of everyone in the team?

  • @zilolv

    @zilolv

    Жыл бұрын

    Hi, db-sync should be installed only once for whole setup and on some server. If you have AWS cloud, ideally you run db-sync on some small machine, or in kubernetes or in some other small deployment option.

  • @joaquinurruti2628

    @joaquinurruti2628

    Жыл бұрын

    @@zilolv Thanks you very much for your answer and congratulations for your job Peter!

  • @joaquinurruti2628

    @joaquinurruti2628

    Жыл бұрын

    ​@@zilolv Hi Peter thank you very much I tryied it and it works seamlessly. I'm thinking of getting a subscription, we are a small team collaborating with data. I wanted to know if it's posible to share one geopackage between different mergin projects?

  • @zilolv

    @zilolv

    Жыл бұрын

    Technically yes, but it is not super recommended atm

  • @MrLESPERGUER
    @MrLESPERGUER Жыл бұрын

    Hello, I have checked in Mergin web site, the db-sync only its available for team suscription, not for professional or indiviual suscription. :(

  • @zilolv

    @zilolv

    10 ай бұрын

    Hi, it is indeed available for team subscription, as well as all on-premises installations.

  • @namratakarki6685
    @namratakarki668511 ай бұрын

    Can we do it using SQL shell instead of Docker?

  • @zilolv

    @zilolv

    11 ай бұрын

    I am not sure if I understand the question, but mergin-db-sync is simply Python utility that can be run in any Python environment, but the easiest solution is to start pre-made docker container with the solution.

  • @namratakarki6685

    @namratakarki6685

    11 ай бұрын

    @@zilolv Thanks ! Will try it !