Viewing posts for the category gis
More fun with IEC elections results data (and maps). The images below show party results (% of votes) by district for a couple of parties. Made using QGIS - I might get a better map up with TileMill soon.
Earlier this year, the IEC released some mobile apps, and an API with full access to election results as they become available. The API has some problems (notably, it requires a username and password which you have to *cough* get from somewhere) but it feels like a step in the right direction. At the moment there isn't any way to get results for all voting districts - rather, they have be requested per district. I used Code4SA's 'IEC API API' and a list of voting districts found in this SQL dump to pull down the results, and I'm sharing the data in case anyone is interested.
The R script below tests whether a set of points on a plane is significantly clustered (as opposed to randomly distributed or, conversely, equally spaced), using the Clark-Evans R measure. From the R spatstat package manual "[Clark-Evans R] is the ratio of the observed mean nearest neighbour distance in the pattern to that expected for a Poisson point process of the same intensity. A value R>1 suggests ordering, while R<1 suggests clustering."
This post shows you (and me when I forget in a couple of months!) how to set up a basic toolchain for spatial queries on Ubuntu 12.04. After installing PostgreSQL and PostGIS, we'll load data from a shapefile, try some queries, and display the spatial database layer in QGIS