MongoDB Plugin for Quantum GIS

Quantum GIS with MongoDB pluginI recently had the need to plot geographic data stored in MongoDB on a map. The data are points (latitude and longitude) for a project at WHERE, Inc. I was using Quantum GIS and the “Delimited Text” plugin that lets you load CSV files (back in the day of ArcView this was called adding an “Event Theme”). So the process was to export the data from MongoDB into a CSV file, editing that file so that latitude and longitude are separate columns, and then loading this edited file into Quantum GIS. This was fine once, maybe twice, but after that I was looking for a more automated solution. The result of this motivation is my MongoDB plugin for Quantum GIS.

The plugin can be found in the Quantum GIS plugin repository (direct link to the containing the plugin).

Writing the plugin has been a bit of a challenge because I have not used Python before. A big thank you goes to Jason Sundram for helping me get up and running with Python. After getting past the python learning curve, I encountered some specific issues with PyQt. I.e., I was not able to install PyQt on OS X (I had to turn to Ubuntu) and that I found the buttons would fire a click event twice (I worked around it by using the “released” events instead). Overall, the plugin is simple. It lets you connect to MongoDB and load all the records in one collection as a layer to the map. There is no support to dynamically load content based on the map view and no writing to MongoDB. The plugin makes use of the PyMongo library, a Python driver for MongoDB.


  1. how can i get pymongo installed/associated with the qgis’s python?

    i have python 2.6 installed separately under program files, and pymongo is installed there; however, that’s not enough as i get a warning message that pymongo is needed for this particular qgis plugin.

    thanks in advance

  2. i’m sure pymongo is installed correctly because I’ve had no problem executing a few simple python/mongodb tutorials and have connected and created dbs via IDLE.


  3. ever figure out why QGIS/MongoDB plugin may not see pymongo install?


    • OK, it happened to me as well. The issue was that the QGIS version I had installed was looking for python 2.6.x whereas I had pymongo installed for python 2.7.x. Updating QGIS to the latest version which uses python 2.7.x solved the issue.
      You can check what version of python QGIS is using by opening the Python Console (in the plugins menu):
      import sys
      print sys.version

      I hope this helps,

  4. I took my pymongo install from my sitelib folder under python 2.7 and put it in the QGIS Python sitelibs folder(C:\Program Files\Quantum GIS Lisboa\apps\Python27\Lib\site-packages).

    Then I built BSON for 2.7 then moved it too.

  5. Does anybody have a working version of the plugin for QGIS 2.x?
    Many thanks for the great plugin!

    • Hey, somebody has approached me telling me that they are working on an updated version. He will post it to the plugin repository when done.

  6. That would be great! Specially as don’t know any other way to pull MongoDB data into QGIS. I think the community would really appreciate if you could share any updates. Thanks!



  1. [...] then, maybe we could delegate the processing on the GIS side. For instance this plugin for QGIS, allows to retrieve Mongo DB spatial [...]

Leave a Comment