I am currently developing a widget Application in Qt, and I need to use GIS in this software.

Naturally I first found the ArcGIS API for Qt, but like ArcGIS, it only runs on Windows and Linux, and not MacOS.

I then thought of QGIS, as it runs on all three operating systems. Yet, I cannot find any online resource that tells me how to integrate QGIS in my application for all three platforms. I only found a few questions here about windows and linux, but nothing about MacOS, nor how to integrate it for all operating systems.

If this is possible, are there resources online that explain how to do this?


This question is quite wide, so it's hard to give a very precise answer. So I'll try to anyway.

Is this possible?



Actually, most resources you find refer to writing plugins, where you have a running QGIS instance and you interact with its components.

What you are looking for here is referred to as standalone application, you want to use pieces of the QGIS API without having a QGIS Application running, so you also need to make sure that the environment is setup properly and things are correctly wired.

Are there resources online that explain how to do this?

The PyQGIS Developer Cookbook comes to my mind. It explains how to initialize things for a standalone application, which is required for Python as well as for any other application.

And of course, the QGIS application sourcecode itself is one huge sample of such an approach.

The steps are roughly:

  • Set the prefix path (depending on the platform)
  • Create a QgsApplication
  • Initialize the application with initQgis()
  • Create any widgets like QgsMapCanvas and work with the API
  • Have lots of fun
  • Call exitQgis() to clean up the application

Another implication to consider is, that if you are using the QGIS API within your application, you will be required to ship it with a GPL compatible license. Unlike plain Qt applications which also support LGPL, this is no longer an option when using QGIS.

Not the answer you're looking for? Browse other questions tagged or ask your own question.