QGIS Planet

QGIS Users Around the World

One of the difficult things to track in the open source world is the number of people who actually use your software. In the proprietary commercial world you have licenses, invoices, and so forth. In the case of QGIS, we can track the total number of downloads from qgis.org, but this doesn’t represent the total installed base. It is impossible to accurately determine the actual number of people using QGIS, but we can get an approximation of the number and where they are in the world.

The analysis was done using the log files from the QGIS contributed repository:

  • The IP address of each entry that retrieved the plugin list from the server represents one or more users—these IPs were collected into a unique list
  • Using a Python script, each IP address in the log was geocoded to get the approximate latitude and longitude of the user
  • The IP address, country, latitude, and longitude were written to a CSV file
  • The CSV file was converted to a Spatialite layer to create the map of users

The map represents 35,603 unique IP addresses of users that accessed the repository between October 23, 2011 and December 17, 2011.

The geocoding process varies in precision—some IPs are located to the city level while others only return a general location for the country.

Some assumptions and observations:

  • Most (maybe all) users make use of Python plugins and therefore access the contributed repository at some point
  • Country-level points (blue) on the map represent more than one user
  • Some points represent organizations that use a single IP for all users accessing the Internet. These points will represent more than one user
  • Some users may access the repository from more than one IP address

So how many people use QGIS? At the very minimum, 35,000. We know that the downloads of just the Windows version exceeded 100,000. Given that there are 7,183 IP addresses that are generalized to a country location, we can safely assume that the number of actual users is much higher than that.

Considering the number of points that represent an organization and those that represent a country location, I think we can safely assume that the number of QGIS users easily exceeds 100,000 worldwide.

Developing QGIS Plugins with git

Writing a QGIS plugin is not overly complicated but represents a bit of work. Using
git in conjunction with your development efforts can make sure your investment in
coding time is preserved.

Development Tools

The QGIS project team has set up a central location for plugin development which includes pretty much everything you need to develop and support your plugins, including:

  • Issue tracking
  • Wiki
  • Documents
  • Repository

The repository feature allows you to create a central place to store your plugin code using git. Others can clone your repository and contribute through patches or pull requests.

Creating a Plugin

The chore of setting up the boilerplate for a plugin is made simple by using the Plugin Builder. Previously this was a web application but it has now been replaced by a QGIS plugin aptly named Plugin Builder. You can install Plugin Builder from within QGIS by selecting Fetch Python Plugins… from the Plugins menu.

Once Plugin Builder is installed you can quickly create a starter plugin that implements a simple dialog box with OK and Cancel buttons. The plugin created by Plugin Builder is fully functional—it will load in QGIS but not do anything useful until you customize it.

Setting up the Workflow

You have a couple of options for setting up your development directory and workflow:

  1. Copy your plugin template to the QGIS plugin directory, initialize the git repository, and develop from there.
  2. Work within your plugin template directory that was created by Plugin Builder (not within the QGIS plugin directory)

Option one is very convenient as long as you don’t test the uninstall feature of your plugin. This will delete your entire plugin directory and git repository—not what we really want.

Option two is safer, however to test your plugin you have to continually copy from your development area to your QGIS plugin directory. Alternatively you could make commits and pull from your development area to the copy (assuming it is a git repo) in the QGIS plugin directory. If you are on a unix based system you could also create a Makefile to deploy the plugin for you.

The best solution is to use option two and use the QGIS_PLUGINPATH environment variable to point to your development directory. When present, QGIS_PLUGINPATH tells QGIS to search additional directories for plugins. Going this route allows you to develop in the directory created by Plugin Builder and test your plugin without any copying or pulling. The upside to this is since your plugin wasn’t installed through the Plugin Installer it can’t be uninstalled accidentally. When you are ready to test the uninstall and unloading of your plugin you can copy it to the main QGIS plugin directory.

Note: If you are using Windows there was a problem specifying QGIS_PLUGINPATH with colons in the path. This issue is fixed in revision 15073 and will make it into the next release.

No matter how you implement your workflow I suggest creating a repository on the QGIS hub (http://hub.qgis.org) or github.com.

Summary

Here is a summary of the steps to get started. We’ll assume your new plugin is named zoomer:

  1. Install Plugin Builder
  2. Create a directory that will contain all your plugins, for example my_plugins
  3. Create your plugin template using Plugin Builder. Be sure to select my_plugins when Plugin Builder asks where to create your plugin.
  4. Change to your plugin directory (e.g. my_plugins/zoomer) created by Plugin Buidler and create a git repository using:
    git init
  5. Set the QGIS_PLUGINPATH evironment variable to point to the directory containing your plugin directory (my_plugins). Be sure to use the full path to my_plugins
  6. Start QGIS and use the Plugin Manager (Manage Plugins… from the Plugins menu) to enable your plugin. If it doesn’t show up in the list of plugins check to make sure you have set QGIS_PLUGINPATH correctly.
  7. Develop away, testing as you go. Make sure to commit changes regularly and push them to your repository on hub.qgis.org.

If you are new to git, take a look at the Pro Git book at http://progit.org/.

For help on developing QGIS plugins with Python, see the PyQGIS Cookbook.

Evolution of QGIS

An interesting visualization of QGIS development over the last eight years:

http://woostuff.wordpress.com/2011/01/03/generating-a-gource-source-commit-history-visualization-for-qgis-quantum-gis/

Contributing to QGIS Using Git

One of the challenges in any open source project is accepting contributions from people that don’t have, need, or want access to your centralized source code repository. Managing repository accounts for occasional or one-time contributors can be come a bit of an administrative issue. To date, the QGIS project has accepted one-time or occasional contributions through patches submitted via a help ticket.

To make it easier for you to contribute to QGIS, we have created a clone of the Subversion repository on GitHub. This allows you to “fork” the QGIS repository and have your own local copy of the source code. Through GitHub you can easily submit your enhancements and bug fixes for inclusion in the Subversion repository.

You will need to install git on your computer and create a GitHub account. Once you have done that, here is the process for creating your working copy and contributing to QGIS:

  1. Login to GitHub
  2. Fork the project at https://github.com/qgis/qgis by clicking “Fork”. This may take a while
  3. Create a working copy, replacing g-sherman with your GitHub name:
    git clone [email protected]:g-sherman/qgis.git

    This will also take a while, depending on the speed of your network connection. My clone downloaded 162 Mb from GitHub.

  4. Change to the directory containing your local clone and add a reference to the original QGIS repo:
    git remote add upstream git://github.com/qgis/qgis.git

    This gives you are reference named upstream that points to the repo you forked.

  5. Now fetch from upstream:
    git fetch upstream

  6. Now you are ready to work with QGIS. Make your changes, commit them, and then push back to your fork on GitHub:
    git push origin master

  7. You can go to your repo on GitHub and you should see your commit message from the push
  8. Now you want to tell the QGIS developer team there is something they should look at. You do this by issuing a pull request by clicking on the “Pull Request” button on your GitHub QGIS fork page.
  9. Fill in a title and message for the request, review the commit(s) and file(s) involved and when satisfied, click “Send pull request”

  10. Now sit back and wait for someone to review, comment on, and hopefully merge your request into the QGIS repo.

    To keep in sync with the QGIS repo, use
    git fetch upstream
    git merge upstream/master

    Make sure to check out these resources for help and more information on working with repositories on GitHub:

GeoApt Spatial Data Browser

This is a project I have had lingering around for a while. It is a geospatial data browser written in Python using the PyQt and QGIS bindings. It allows you to navigate a tree structure and preview raster and vector datasets. Metadata extracted from the data can be viewed as well. It supports drag and drop for any target that accepts filenames (e.g. QGIS). For screenshots and more, see http://geoapt.com/geoapt-data-browser.

The code is now available on GitHub (see https://github.com/g-sherman/GeoApt) and ready for you to contribute. Take a look and if you want to get your hands dirty fork the project and start coding.

Lots of features are missing—consider this an alpha version…

Back to Top

Sustaining Members