Eclipse is a Java IDE right? Wrong! You can use it for other languages too! I have been needing to improve my debugging techniques for python and Django (more on that in the future). This post outlines how you can set up Eclipse with PyDev to work on an existing Django aplication. The benifits? A complete IDE environment with a debugger that will let you set breakpoints anywhere in your app and interactively step through the code from that point. You also get other nice things like refactoring support, code completion and so on. I’m still a dyed in the wool command line user since I can use my same development environment both locally and on a remote server effortlessly, but for training courses and those who prefer to use a GUI, PyDev on Eclipse will probably make a compelling alternative. lets see how to get is set up (after the break below)…
Lex Berman from Harvard just dropped me a nice email with a link to an interactive QGIS tutorial he has created. The tutorial is one of the nicest I have seen – each section is detailed with text, screenshots and howto videos. I thought I would make a quick post about it here so the rest of the world can enjoy it too!
Everything I’m about to tell you you should probably forget – in my brief experience with it, Eclipse makes for an inferior alternative to Qt Creator if you are looking for a GUI to do development on QGIS with. That said, there are those for whom Eclipse is their weapon of choice. My primary motivation for testing eclipse was that I wanted to use the Eclipse refactoring tools which in days of yore when I did a lot of Java programming proved to be the IDE’s saving grace. I wanted the refactoring tools because for QGIS 2.0 we are planning an API cleanup and I was hoping that it would make the process easier. Ok so let’s dive in (read on after the break for details)
Running a small business is a challenge. I came into this as a FOSS geek with a grandiose plan of spreading the FOSS GIS goodness far and wide and somehow earning a living from it. I don’t have an MBA or any significant business skills so I have been learning everything from first principles as I go along. Using Scrum project management has been a huge step forward for us and has been instrumental on us creating a much more effective work process within the office. The next biggest challenge we have faced on our journey is how to motivate and get the best out of our staff. Having staff is a double edged sword in a small business – they can boost your productivity and earning power, but they also cost a lot of money and time (training and supervision). One of the things we do with our staff is have a bonus system whereby a percentage of their salary is dependent on performance. This theoretically motivates them to work harder to achieve their maximum earning power.
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:
table th, td {
padding-top: 3px;
padding-bottom: 2px;
line-height: 50%;
}
You may want to add some more to this for the sake of appearance, but that’s the gist of it.
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:
[advanced_iframe securitykey="da39a3ee5e6b4b0d3255bfef95601890afd80709" src="http://www.youtube.com/embed/TVVvFzvhCUM" height="315" width="560"]
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.
