Kartoza - How to Load a QGIS Project in Python
Loading a QGIS project in python
·
1 min read
Today in a project we are working on we wanted to load a QGIS project. It takes surprisingly few lines of code to make a small standalone application that loads a project and then shows it as a map in a window like this:
Here is the code I wrote to produce this:
The main bit of magic is the QgsLayerTreeMapCanvasBridge class which will convert your project into a layer tree so that the layers appear in the canvas. If you ever need to make a standalone python application with a nice map in it, consider using the QGIS API to do it!
No comments yet. Login to start a new discussion Start a new discussion