Seems this is a good day for QGIS Oracle users. According this commit made by Jürgen QGIS now has built-in Oracle support. Win!
Native Oracle support can now see QGIS being opened up to a wider user base yet again. A large user base normally means more people willing to sponsor awesome new features and bug fixes. Having seen the growth in the user base from having native MS SQL Server 2008+ support I can imagine what it will be like with Oracle.
The list of formats QGIS can open and edit is getting larger and larger with each release. Is there a future for vendor lock in? I can’t see it.
Standard disclaimer about latest dev build and new features:)
This has been part of an ongoing effort from the documentation team since before the 1.8 release to bring our all our documentation into reStructedText rather then LaTeX. Moving to reStructedText allows quicker updates and a larger range of final output formats.
I would like to thank everyone who has been involved in this process as I know what a grueling process updating documentation can be.
Just remember you don’t have to be a programmer to contribute to an open source project. If you think you could contribute to the updating of the QGIS documentation please contact the team on the mailing list.
As QGIS is such a fast moving project I have decided to make this a regular blog post in order to highlight some new features added to QGIS. If you haven’t already, don’t forget to check out round one.
Remember that some of these features may still only be new which might change between now and the next official released version. With that out of the way lets get listing.
If you are a regular user of QGIS Python plugins, and who isn’t, then you would have used the awesome Atlas plugin developed by Vincent Picavet. This great tool can be used to generate mapbooks, or an atlas as some people like to say, using a coverage layer and a print composer. What makes this even more awesome is that it is now built into the print composer.
The builtin atlas function also gives you the ability to use an expression to do runtime text replacement, including access to all the fields on the coverage layer. The coverage layer doesn’t even have to be a region layer, it can be a simple point layer, or even a line layer. You can see the result of me running the atlas generation from the above example here
Big thanks to Oslandia for integrating this great feature, and the companies sponsoring the work.
New Python console
This new addition comes from the great work that Salvatore Larosa has been doing to add a better Python console to QGIS.
The new Python console includes attribute auto complete, syntax highlighting, better copy and paste, uploading to codepad, the ability to run code from a file, etc. You don’t realise how much difference there is until you go back to using the old one in version 1.8.
Tabbed and groups in builtin forms
One of the things I really loved about QGIS, coming from MapInfo, was the builtin forms. Just having the ability to enter data using controls like combo boxes, calendar widgets, etc makes you one step closer to having better data. This feature is the exact reason I setup a 67 year old for kerb data collection.
As good as they are the builtin forms have an issue of ending up with as a big scrolling list with lots of fields; also the lack of the ability to group or put fields on tabs in the UI meant you had to create a custom form. Well not any more.
There is now a combo box on the Fields tab that allows you to build a generated form but also add tabs and group boxes. You can even have the same field shown more then once on the form, handy for something like an ID field that you would like to show on each tab.
With this new ability the builtin forms can get me 95% of the way for data entry jobs, the other 5% I just make a custom form – but that is very rare.
Sextante is a great and powerful analytical framework that has been added to the core of QGIS thanks to Victor Olaya. This is not a feature that I use a lot but this is only due to most of my work being in development and not analysis, however that doesn’t mean that it’s not a really cool feature.
One of the greatest things about the Sextante toolbox is that it allows you to integrate other great open source tools like GRASS, SAGA, R, OTB, etc, right into your QGIS workflow and view the results in the canvas. It even includes a modeller so that you can build a connected diagram of all the bits of your process, even if it crosses between programs.
For me what is even better is that you can use Sextante in your plugins or custom Python code. Sextante has a Python interface – well the whole thing is written in Python – that you can use to run a Sextante supported algorithm.
Last Thursday and Friday was our first local Australian FOSS4G event which was hosted at the CSRIO building in Brisbane. Very big thanks to CSRIO for hosting the event. The venue was setup perfectly for hosting an event like this, including dual projectors for presenting, video calls over to Perth, etc.
The first day was done using a un-conference style of event. This is the first time I’ve been to a un-conference and I liked the format a lot. Once everyone was there on the first morning we collected ideas from people and everyone voted on which ones they would like to see. After we had picked enough topics Shaun and I made a program for the day and we started.
The second day was a code sprint. I worked on converting a MapBasic scripts from one of the guys to QGIS, and Jody enlisted the others to help check the headers of the GeoServer project so that it can finally pass OSGeo incubation.
Overall I think it was a very successful event. I would like to make these a yearly event if we can, provided that we have people to talk, or projects to work on.
Ever since I added expression based labels, including the new expression builder UI, something that I always wanted to add is the ability to define custom user defined functions in Python (or C++) and use them in an expression. The expression engine is used for labels, rulebased rendering, layer actions, field calculator, and atlas composer tags. Thanks to the all the awesome work on the expression engine by Martin all this cool stuff is now possible.
Today I pushed a commit into master that adds the ability to define a function in Python (or C++), register it in the expression engine, then use it anywhere expressions are used.
The good stuff
Lets take a use case from Ujaval Gandhi and his example of counting vertices for each feature.
First we need to import the new qgsfunction decorator function from qgis.utils. The qgsfunction decorator will take a normal Python function, wrap it up in the class used to define a function, and register it in the engine.
So what does an empty function look like:
from qgis.utils import qgsfunction
from qgis.core import QGis
def vertices(values, feature, parent):
@qgsfunction(0, "Python") means we are defining a new vertices function that takes 0 args and lives in the “python” group in the expression builder UI. Any custom function must take (values, feature, parent) as python args. values is a list of QVariants passed into the function, feature is the current QgsFeature, and parent is expression engine node (you use this to raise errors).
Lets stick some more logic in there:
from qgis.utils import qgsfunction
from qgis.core import QGis
def vertices(values, feature, parent):
Returns the number of vertices for a features geometry
count = None
geom = feature.geometry()
if geom is None: return None
if geom.type() == QGis.Polygon:
count = 0
polygons = geom.asMultiPolygon()
polygons = [ geom.asPolygon() ]
for polygon in polygons:
for ring in polygon:
count += len(ring)
Pretty simple. Get the geometry from the feature, check if it’s a polygon, if it is then count the number of vertices and return that number.
Now that we have that all done we can save it into a file in our .qgis/python folder, lets call it userfunctions.py (note you don’t have to save it here, anywhere that QGIS can find it will do. Anywhere on PATH)
Lets open QGIS and run import userfunctions.py:
Now open the label properties for the layer:
Nice! Notice also that the function doc string is used as the function help. How cool is that. You can also see the $ sign in front of the function, this is because any functions that take no args are considered special and use the $ sign as a convention, this is all automatic when the function is registered.
And the result is:
You can even use it in the rule based rendering:
You must unregister a function once you are finished with it using QgsExpression.unregisterFunction(name). This mainly applies to plugins where the user might unload your plugin and the code is no longer available. In the above example we could import userfunctions and never unregister because we plan on using it for the whole session.
Recently there have been some great new additions to the QGIS project. Being part of such a fast moving project is a great feeling, and it’s only going to get better.
This post is going to be a quick over view of some of the newer features that I really like.
Well of course I like this one, I just added it. The reason I added this feature was because I really wanted to way to have popup images on the map canvas for flood damage reports on roads. I also wanted it dynamic so I could use template like syntax to replace values at run time.
I’ll let you think of some nice use cases for this new addition.
Project macros and non blocking notifications
This new feature comes from Giuseppe Sucameli of faunalia with the work done for ARPA Piemonte.
The task was to add Python macros that run when a project is open, saved, closed. As a side effect of the task the issue of security was raise and how to notify the user that macros are going to run. For me this was less about security and more about how to present that information to the user without annoying the crap out of them. Most of the time popup dialogs in software are a anti-pattern and are often abused for tasks like this. So knowing I would throw my computer out the window if I had to dismiss yet another dialog I suggested a less intrusive method being used a lot these days. The handy slide out notification bar. Giuseppe was very welcoming to the idea and implemented it nicely.
Of course this addition can also expanded into other areas of the program. My first plan is to use it for notifying the user of plugins to failed to load. There is nothing in QGIS that annoys more then starting and seeing this:
To make matters worse if more then one plugin fails to load then I have to dismiss each dialog. So we can now use the notification bar to present it to the user in a nice non-blocking way. Something like “BTW four plugins failed to load at startup. What would you like me to do?”
Remember each time you use a blocking popup dialog it’s pretty much yelling at the user “OMG GIVE ME ATTENTION!! NO YOU CAN’T KEEP WORKING! GIVE ME ATTENTION!”
I’m working on a patch to move this stuff into the notification bar just no ETA at the moment as I’m a bit busy.
Larry Shaffer has been working on some great improvements to the new labeling engine in order to make our maps look a lot more professional. Larry has been doing a lot of work in this area and is still going so I’m not going to go into all the details. However one new labeling feature that I really like is the ability to to set the spacing between letters and words.
There is also the new ability to set the transparency of the label and the buffer. The buffer transparency is something that I really like as sometimes you need a buffer but a solid buffer can then block out your map features; by adding a 45% transparent buffer I still have the labels pop off the map but not in your face or blocking features. It’s hard to make a picture to explain it well so you’ll just have to experiment.
This one could be quite handy for people that make a lot of maps with the same base data. Thanks to Etienne Tourigny QGIS can now load projects as a template. This means you can create a project with all your base layers, styles, labels, etc, configured and then load it by default, or from the file menu, and you will have everything setup. All you have to do is save the a normal .qgs project file in
~/.qgis/project_templates folder and the project will be shown in the file menu.
You can also set the current project as the default template:
And last but not least. This years GSoC student Arunmozhi got the improvements he had (has) been working on included into the master build. Arun was very welcoming to any feedback that Martin and I gave him about how we would like symbol stuff to work. Anita Graser has already covered a lot of the new features over on her blog so I’m not going to go over everything again, although one thing she didn’t really touch on was the smart groups and tagging.
The tagging and smart groups are one of my favorite additions to the new symbol manager.
I love this new feature as not all the symbols I create belong to a single group so the tagging and smart groups fit this bill well. I can now tag all the council symbols with ‘SDRC’ and include them a SDRC smart group but at the same time tag the sewer ones with ‘sewer’ and they can live in the sewer style smart group; or how about all sewer symbols that are also SDRC ones:
You can then filter by this group in the symbol selector:
I really love how fast QGIS is moving forward. There almost isn’t a week that goes by that something isn’t getting done or someone is adding something new. Of course the great people on the project make this process a hell of a lot of fun and enjoyable.
Have fun experimenting! (remember that these features are in the master development build and may or may not have bugs)