# Integrate Mergin Maps

Mergin Maps is an open platform that aims to be developer friendly and it has been designed to allow easy integration with other software.

# Python client module

The Python client module is the easiest way to programmatically use Mergin Maps. You can use Python API or a command-line tool to easily work with Mergin Maps projects, such as to get project status, push and pull changes, or to download, create and delete projects.

The MerginMaps/mergin-py-client (opens new window) repository contains the source code of the Python client module and more information on how to use it.

Python client is available in the PyPI repository and can be installed with pip:

pip3 install mergin-client

# Python module

To use Mergin Maps from Python, just create MerginClient object and then use it. Here, for instance, to download a project:

import mergin

client = mergin.MerginClient(login='john', password='topsecret')
client.download_project('lutraconsulting/Basic survey', '/tmp/basic-survey')

If you have Mergin Maps plugin for QGIS installed and you want to use it from the QGIS' Python console

import Mergin.mergin as mergin
client = mergin.MerginClient(login='john', password='topsecret')

# Python command line interface

For those who prefer using terminal, there is mergin command line tool shipped with the Python client. With several built-in commands, it is possible to download Mergin projects, push/pull changes, create or delete projects and more.

For example, to download a Mergin project to a local folder:

mergin download john/project1 ~/mergin/project1

For more details, visit MerginMaps/mergin-py-client (opens new window).

# C++ standalone client

C++ Client has advantage over Python that it is completely without any dependencies.

To install the C++ client, just download the binary for your platform from MerginMaps/mergin-cpp-client/releases (opens new window) and use it from the command line.

Go to MerginMaps/mergin-cpp-client (opens new window) repository for more information on how to use it.

# C++ Command line tool

When the client is installed, it comes with mergin command line tool.

$ mergin --help
Usage: mergin [OPTIONS] COMMAND [ARGS]...

  --help      Show this message and exit.
  --version   Show the version information.
  --username  Mergin username (or MERGIN_USERNAME env. variable)
  --password  Mergin password (or MERGIN_PASSWORD env. variable)
  --url       Mergin url      (defaults to app.merginmaps.com)

  create         Create a new project on Mergin server
  download       Download last version of mergin project
  sync           Pull&Push the changes
  remove         Remove project from server.

# C++ Mergin API core library

Client is based on the Qt-based mergin api core library (opens new window) used by the Mergin Maps Input to sync the projects in the mobile application.