I’ve been a VIM user for many years and over that time I have tweaked my vimrc a little (not too much mind you). I have one modification that I use probably hundreds of times a day.
" Added by Tim to map alt-left/right to flip through buffers
nmap <A-Left> :bp<CR>
nmap <A-Right> :bn<CR>
Adding the above to your ~/.vimrc file will let you quickly hop between buffers – pressing alt-right arrow will take you to the next buffer and pressing alt-left arrow will take you to the previous buffer.
So my previous article about fusing QGIS Desktop with web technologies generated quite a bit of interest, including some people interested to start hacking on it (always a good sign). In this article I want to show the next level of functionality we can obtain by means of a simple example. There won’t be any flashy graphics here but hopefully it will give you inspiration for other things we can do.
Here is the executive summary and a quick video to demonstrate it:
I replaced Metadata tab in the QGIS Raster Layer Properties with a QWebView widget
I created a simple web page that accepts a C++ QgsRasterLayer object and then does stuff with it
I implemented a Q_PROPERTY on QgsMapLayer (the base class for all map layers) that exposed the metadata property as a read-only property.
I created a customised BluePrint CSS template (using a narrower format than the traditional 960 grid) and deployed it in QGIS resources
I added a simple button to the form and used a bit of jquery and javascript to call a slot on the QgsRasterLayer and retrieve its min and max scale properties, then update the page
If you’ve tried centering table cell contents in xhtml2pdf, you’ve probably noticed that it doesn’t work. The typical symptoms seem to be that cell contents are right against (or even over) the upper border of the cell.
For reasons unknown, xhtml2pdf ignores “vertical-align” instructions, so you can’t use that. To solve the problem, I did this:
The Python bindings for QGIS introduced just before version 1.0 was released proved to be a huge boon to the development of QGIS as a popular, free alternative to proprietary vendor’s offerings. More than 100 plugins grace our plugin repository, and the ability to use Python scripting has really lowered the barrier to entry for many who would find building similar tools in C++ (the ‘native’ language of QGIS) too intimidating. Lately I have been pondering the future of QGIS 2.0. In particular my feeling is that we pretty much have the standard functionality of a desktop GIS application covered and it is time to step out of ‘emulate’ mode into ‘innovate’ mode. Not that QGIS 1.x entirely lacks innovation, but I believe there is a lot more that can be done.
At the recent developer meeting in Zurich, I had some enjoyable conversations with Andreas Neumann and others. Andreas showed off some examples of the awesome D3 javascript svg visualisation toolkit. I had seen the kit before in its former guise as protovis, but I hadn’t ever seen quite the extent of all the cool things you could do with it. Parallel to Andreas’ presentation, I had been pondering fusing web technologies with QGIS. Now let me start out by explaining that living in a low bandwidth society has made me quite cautious about building web tools for the masses, but what I am talking about here is using web technologies on the desktop without any need for an internet connection. D3 is just one example of many hundreds of javascript libraries out there that cover a whole gamut of functionality. I would argue that the javascript universe is far richer than the Qt/C++ one and far easier to ‘pick up and use’. Combined with this rich javascript resource is the fact that recent versions of Qt4 ship with QWebView, a webkit based widget that you can place onto any form. More than that, Qt4 provides entry points for calling javascript routines from C++ and passing C++ objects into the javascript context. Though I havent tested it yet, you can also use Qt4′s signal and slot mechnism from within the Javascript context.
If you take a minute to think about this, you will realize that this opens up a world of possibilities: what if we use C++ for the heavy lifting and Javascript + CSS + html for our visualisation in QGIS? Not for map rendering per se, but for all the other places where you need to see charts, tables, reports, metadata and so on. And what is really nice is that we have a fixed browser platform to work against, and complete platform independent capability, without any of the overhead that Python for example introduces (like having to ship a separate interpreter with the QGIS binaries). Plus the multitude of people that can already do web programming suddenly have an easy way to start contributing to QGIS.
To demonstrate this idea I have updated my fork of QGIS to use JQuery, Flot and some html to do the rendering of the histogram in the raster layer properties dialog. You can see a little demo of this below:
While building this I noticed a couple of nice benefits:
I can debug my javascript separately in a browser
I can update the html / javascript and simply reinstall those files while QGIS is still running and immediately see the results
Whatever libraries I chose to use (jquery and flot in this case) were trivial to package with QGIS and I didnt need to worry about making the user e.g. install a separate python package before they could use my code
The code to implement the graph was much simpler than my former Qwt based implementation and it was trivial to add the zoom capability shown in the video above
The rendered graph looks much nicer than the Qwt one it replaces without any effort on my part
It was fun to work on!
And this last point is probably the most important – the more fun it is to hack on QGIS, the more likely we will get others to contribute. Hopefully we can also start attracting web innovators like my friend Javier de la Torre from Vizzuality to see QGIS as a place where they can bring the awesome stuff they are doing on the web into the desktop environment! I have quite a few other ideas as to how we can leverage this technology further so look out for further posts on the topic.
Building a wizard in designer is overly complex and has a few pitfalls. This is especially the case when you try to build your wizard using Qt4 Designer exclusively. The main problem comes in due to the fact that although you can happily place any widgets you like onto a QWizardPage, in the QWizard you cannot actually access them at run time. So that makes it useful for adding static content like labels or text but pretty challenging for everything else. A while ago I implemented a welcome wizard for QGIS but never actually applied it trunk. Today I had occasion to dust off the cobwebs and I thought I would write this up to explain how I did it since you won’t find much help on Google on the matter.
Recently, XKCD strayed into our territory with this page about map projections:
To be honest, I’ve always like Gall-Peters myself, if only as a way to illustrate how map projections distort the appearance of continents. It’s quite effective at conveying this concept, because it distorts things in the opposite direction of the universally familiar Mercator. If you’re using it as a legitimate map projection, though, I honestly don’t know what to say to you.
Alex Mandel on #qgis IRC channel pointed me to this site: https://www.startssl.com/ which issues level 1 SSL certs for free. We are in the process of getting a certificate issued for QGIS.org but the site is generally useful for others who would like to obtain an SSL cert for their site easily.
Here is a nice article about teaching a semester course with FOSSGIS that William Kinghorn put me on to:
However, most students are shocked to discover how many capable FOSS GIS software packages exist and are excited that they can just download and install them, even on a Mac. They ask questions like, “Why isn’t everyone using QGIS?” Frequently students end the semester wanting more.
At the recent get-together, I made a bunch of short clips with most of the attendees. These are presented below (or on my youtube channel). My apologies if you need to tilt your head 90′ left for some of them, YouTube’s online video editor is still a work in progress it seems… Just play the first video and the rest will follow automatically.
I am writing this sitting on the plane making the ~25 hour return trip from Zurich to Swellendam (via Dubai) and as has become tradition, I thought I am making this summary of the activities at our bi-annual QGIS developer meeting. The developer meetings themselves have become a huge propellant to the project – bringing together developers and users from all areas of the project and providing a forum for us to plan and discuss things at a level of detail that simply isn’t possible via email, IRC and so on. The meeting also acts as a catalyst where a few moments spent between two people can provide the needed knowledge transfer to enable new contributions of code, bug fixes, documentation or whatever else is needed to cross a barrier that would otherwise prevent a person from helping the project.
We have now held developer meetings in Hannover, Vienna, Pisa, Wroclaw, Lisbon and Zurich and due to the kind contributions of our project sponsors have increasingly been able to cover the costs of attendees. This year all the meals were paid for by sponsors / donations, as well as the travel and accommodation for some developers. A number of Zurich residents also opened the doors of their homes to provide accommodation for attendees. In addition each attendee contributed time out of their personal and professional lives that if we were to pay for this time in professional fees would amount to a massive investment.
This year the QGIS project has had two silver sponsors and the increasing levels of sponsorship are really a fantastic enabler for us to move the project forward significantly. I am looking forward to the day when funding levels have reached the level that a number of us can be employed by the project to work on improving it in a general way rather than meeting the specific needs of a single client. For more information on how to sponsor or donate to the project, please see http://qgis.org/en/sponsorship.html.
Our host for the meeting was the Institute of Cartography, ETH Zurich. We would especially like to thank the following people who facilitated the meeting:
Ionut Iosifescu for helping to organize the meeting and arranging for permission for ETH to host it.
Prof. Lorenz Hurni, department head at the institute for generously agreeing to host the meeting.
Corina Pachlatko - the secretary for organization and providing food/coffee!
The State of Vorarlberg (our latest silver sponsor) for their donation which covered the costs for attendee travel and accommodation and really helped to jump start proceedings.
Peter Oberholzer from the City of Uster for covering food expenses.
Marco Hugentobler, Pirmin Kalberer and Mathias Walker from Sourcepole for helping to organise the meeting.
The City of Uster paid for the food/bread/supermarket bills.
Andreas Neumann who helped to organise the event and donated his time and money to make it happen.
There are many more who worked hard behind the scenes to make the event happen, and we extend our thanks to you all! The food provided was really tasty including these delicious salty ‘pretzel’ things:
Delicious food and snacks kept the attendees going at full tilt!