spacedman's blog

New plugin - topological colouring

Well I've finally released my graph colouring plugin, 'topocolour'.

Are you bored with Qgis' default of loading a polygon map and setting all the polygons the same colour? Well why not try 'TopoColour'! It combines the prettiness of ColorBrewer palettes with graph theory to colour your polygons so that no adjacent polygons are the same colour. In just two easy steps!

Unattended install of Qgis (et al) from OsGeo4w

The OSGeo4W stuff crept up on me quietly. Suddenly there's this cygwin-like installer that bundles Qgis, uDig, Grass, web-mapping, and all the lovely libs in one neato package. That's a win.

But I still wanted an easy way to install qgis without the use having to choose which of the packages they wanted, and set options to install, and not get confused by some of the other options in the installer. So I went on the hunt for how to do an unattended install from a set of packages (ie not from the internet).

Contour Lines in Qgis

What with the GSoC project and all the other general discussion about analysis tools in QGis, I got somehow sidetracked into pondering how to do contour maps in QGis. There's the hard way: writing a bunch of C++ code to implement a contouring algorithm, then hooking that into QGis and into the GUI for raster drawing properties. Ah, no.

Writing a Renderer in Python

For my project I want to display point data in pretty colours. I have survey data for villages that record the number of cases of disease and the village population, and I want to colour according to the percentage infected. Red for high, green for low.

Writing a QgsMapTool in Python

For my project I need to give the user three ways to define a rectangular area: it can be the bounding box of a layer, it can be the current view area, or it can be defined by the user drawing a rectangle. My main dialog covers the first two options with a dropdown and a push button, but the third option meant writing a map tool - in Python of course!

The code and details are downloadable from my site.

QGis and Python and R and statistics

Last year I worked on integrating some statistics code with a GIS. After looking at as many open-source cross-platform GIS as I could find, I got stuck with OpenEV. It did the job - just. Its big attraction for me was the built-in python scripting and API - a python script could create new menu items, Gtk dialogs, access map data, create new layers and so on.

My code had to talk to R, a statistics package (www.r-project.org). I did it using Rserve - in this way, R opens a socket on localhost and listens for requests. There were no python bindings for Rserve so I dissected the protocol and wrote my own. Job pretty much done.

Then late last year I upgraded my desktop box to Ubuntu (from RH8). Upgrade time for R, OpenEV, python and so on. Plus the realisation that this code would all have to run on Windows, by non-geeks, in remote villages in Africa.

Syndicate content