- Announcing the release of QGIS 1.5 'Tethys'
- Quantum GIS on steroids
- Annotation tools
- Announcing the release of QGIS 1.4.0 'Enceladus'
- Carson Farmer's report back on the Vienna Hackfest
- Vienna Hackfest 2009 Report Back
- Introducing the QGIS Hackfest (Vienna 2009) crew
- Announcing the release of QGIS 1.3.0 'Mimas'
- Announcing the releases of QGIS 1.0.2 (stable) and QGIS 1.1.0 'Pan' (unstable).
- Summer of Code project: Label placement
The new era: QGIS and Python
Few days ago I've seen in PyQt4 ChangeLog that there has been added support for Qt4.2 classes recently. I couldn't wait for official release, downloaded the latest snapshot to see if we can move on with Python bindings for QGIS. Sure we can!
First just a small note: everything mentioned here applies only to branch called Lib_Refactoring-branch in SVN which currently serves as my playground with new technologies :-)
I've started to work on python bindings for QGIS already back in april this year. But that time I've encountered a big problem: PyQt4 didn't wrap Qt3 support classes, nor Qt4 equivalents for QCanvas (used by map canvas) have been available. But nowadays we have replacement of QCanvas called QGraphicsView in Qt4.2. Since the latest PyQt4 snapshots contain support for new Qt4.2 classes there's no excuse for not having wrapped the GUI library.
In fact once you get used to it, wrapping classes with SIP is easy and quite fast - the GUI library is now completely wrapped (well, there are only 13 classes - CORE library is much bigger). The updated list of wrapped classes is located on wiki (the classes marked with a checkmark on the right). So let's look at the new possibilities:
- create GIS applications in Python - yes, now you can create your own applications which will use QGIS libraries just with Python and no C++ code! To prove it I've ported some of Tim's tutorials. Take a look at the complete tutorial 5 in python.
- automate some tasks in QGIS - with python console embedded in QGIS that can access map canvas you're able to enter any python commands to make some tasks easier and more automatic.
- plugins in Python - creating a plugin with python is surely much easier that doing the same in C++. Why? You don't have to recompile the plugin on every change, shorter sources and less error-prone code!
At the end let's look in the bright future of QGIS :-)
(click to see them full sized)
Python console (still needs many improvements but already usable):

Tim's tutorial 5 - completely ported to python:

But we're still not at the finish line:
- many classes from core library are not yet wrapped
- some functions are not yet available in wrapped classes
- support for python plugins is missing
- maybe some bugs in bindings
| Attachment | Size |
|---|---|
| tims_tutorial_5.png | 96.52 KB |
| python_console.png | 99.21 KB |
| mainwindow.py_.txt | 3.65 KB |
- Martin Dobias's blog
- Login or register to post comments
- 14591 reads

Sweeet
Now, if you can get the Rpy [http://rpy.sourceforge.net/] python package working with qgis/python then you'll have answered my prayers...
I've been trying to develop a GIS interface to R's statistics for sometime, using OpenEV, but I've always found OpenEV horribly clunky and non-standard in its user interface. Python plugins for Qgis that can call R would be heaven - but only if they work on Windows and Linux!
Oh well, something to try on Monday...
Rpy, QGIS and Python
Seriously, has anyone got the Rpy python package to work with qgis and python yet? I noticed the above Anonymous post recently, and I'm currently experiencing the same problem...
Cheers,
C
Rpy, QGIS and Python
Maybe this can be useful:
http://finzi.psych.upenn.edu/R/Rhelp02a/archive/113138.html
as
Fanstic work Martin
Martin as usual you are making me a happy happy dude! This is really great work!
Regards
Tim