How to connect PostGIS and Mergin Maps

Поделиться
HTML-код
  • Опубликовано: 26 ноя 2024
  • 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/Mer...
    1) Setup PG container
    curl raw.githubuser... -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.githubuser... -o config.yaml
    cat config.yaml
    mergin:
    url: app.merginmaps...
    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...
    merginmaps.com...
    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 Год назад +1

      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 Год назад

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

  • @namratakarki6685
    @namratakarki6685 Год назад

    Can we do it using SQL shell instead of Docker?

    • @zilolv
      @zilolv Год назад +1

      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 Год назад

      @@zilolv Thanks ! Will try it !