QGIS Plugin development (Installation and Configuration) on Windows

I have experience of more than a year in QGIS Plug-in development, and I have developed variety of plug-ins for spatial data management, geospatial data visualization, spatial data analytics and spatial data editing. This is also my first story on medium and I will share the gist of my experience and proper guideline to start QGIS Plug-ins development.

I have noticed that whenever somebody is starting QGIS Plug-in development in QGIS, it is very difficult to find easy to follow documentation to install and configure QGIS plug-ins, particularly in case of windows for newbies and that is why they always stuck at some point in installation and configuration of QGIS plug-ins. That is why i decided to share my experience for developing QGIS Plug-ins, because i have been building a lot of QGIS plug-ins on windows, and i believe that this might help to save time for installing and configuring QGIS Plug-in environment.

A little about QGIS

QGIS is a free and open source desktop cross platform application that supports visualization, editing and analysis of geospatial data. Some people find QGIS to be alternative to a famous Enterprise solution ArcGIS. But both have their own pros and cons. I will not good into debate of which of them is good or bad and for what purpose. For more detailed comparison between these you can check ArcGIS vs QGIS comparison

QGIS Plug-ins:

QGIS Plugins are extension to QGIS, in order to extend the functionalities of QGIS and develop custom logics that can be used to interrogate Geo-spatial data. When you will install the QGIS, you will see the list of some plug-ins already available. These are the plug-ins that you get on installing the QGIS. QGIS Plug-ins can also be downloaded from on-line repository of QGIS, where people have shared their contributions for public use. You can check Repository of Plug-in, to see available plug-ins.

Creating and Configuring QGIS Plug-in:

For installation and configuration of QGIS plugin you need to have basic understanding of QGIS and Python(2.7):

You also need to install:

  1. QGIS: QGIS can easily be downloaded and installed from here. Make sure that you selected the appropriate version according to operating system. For this tutorial we are focusing on window’s version.
  2. Text Editor:You will need to have a text editor for editing the code of . Plug-in. There are many text editors available e.g. Sublime, Notepad++, PyCharm. You may choose as per your reference

Steps to Successful Creation of Plug-in:

  • Download the QGIS and install it on your machine. Use the default Configurations, it will install the QGIS in C:\Program Files on windows.
  • After installing QGIS Desktop, run it from the Start Menu.
  • Close the tips that you will see after QGIS has been started
  • Once QGIS is open, You will see a lot of icons on the top bar and menu in QGIS. Every option represent a different functionality of QGIS and Geo-spatial functionality.
  • From the Menu bar, Go to Plug-ins Menu, and in the plug-ins menu you will see an option of “Manage and Install Plug-ins”. Click on it, and it will fetch repositories that is provided where all contributed plug-ins are available.
Plug-ins Menu
  • Click on “Manage and install Plug-in”, it will open a dialogue box of Plug-ins. In the Search box, search for “Plug-in Builder”. Plug-in Builder is QGIS plug-in, that is available within QGIS repository, the main purpose of this plug-in is to provide a basic structure or template for development of further development of the plug-ins.
Download and Install Plugin Window
  • Install “Python Builder plug-in”.
  • After the installation of the Python builder plug-in, You will see an icon in QGIS for Python Builder plug-in
  • Click on the icon, that will open a dialogue box, fill in all the information that is required, for the Python Builder. For more about Python Builder plug-in, you can check this Tutorial and Tips
  • Save your new QGIS plug-in into
C:\Program Files\QGIS 2.xx\apps\qgis\python\plugins
  • After installation and creating of new plug-in go to Manage and install plugin again, and install a new plug-in “Plugin Reloader”. Plug-in Reloader helps to re-compile plug-ins within QGIS, without QGIS to be restarted
  • Now go to start menu and type OSGEO, it will open a shell. This is default installed with QGIS. In case if you have multiple OSGEO, i would recommend that you use the one that is installed with QGIS.
  • In the shell type below command where the path is the one where plugin is installed/saved.
cd C:\Program Files\QGIS 2.18\apps\qgis\python\plugins\{PluginName}
  • You may also install the plug-in to below path as well, but in this case that plug-in will be accessible to only that one user that has created the plugin.
C:\Users\User name\.qgis2\python\plug-ins
  • Your OSGEO shell will now point to plug-in directory.
  • Run this command in that directory
pyrcc4 -o resources.py resources.qrc
  • If no error is shown in the shell, then everything is fine and the plugin’s resources are successfully compiled.
  • Restart QGIS.
  • Now go to “Manage and install plug-in” from the menu bar under plug-ins.
  • Go to Installed plug in from left sidebar.
  • Click on the check-box of the Plug-in, that has the name you provided on creation of it.
  • If there is not warning or error, you are good to go.
  • New plugin with default icon will now be visible on QGIS interface.
  • You can click on it, to see an empty interface, this is because you have not added any functionality of it.

Development of the Plug-in:

You can use QT Designer that is also installed with QGIS, to develop an interface of the plug-in, using the .ui file that is created with the Python Builder. For more about the development of the plug-in, methods, modules and libraries you can Follow QGIS Tutorial and Tips, where from you can get good detail description about the plug-in development. You can also can detail about coding methods that will be used for the plug-ins. The whole development wander around PyQt4, Python2.7 and PyQGIS

QGIS development, more specifically QGIS plug-in development has always been a helpful procedure. QGIS plug-ins can help you automate complex tasks, and reduce redundant effort that is involved in your daily work. Anyone with basic background of QGIS and Python can build their own plug-ins, and you can bring any idea in the form of plug-ins.You can bring and Statistical, Geo-statistical, Database DDL/DML operations into one platform.