QGIS course at AfQUA
Kartoza has just wrapped up a three-day Introduction to QGIS course that we gave pro bono at The African Quaternary: Environments, Ecology and Humans conference in Cape Town (AfQUA2015). Thank you to Kelly Kirsten from the local organising committee at the University of Cape Town for inviting us. Admire Nyakudya presented to about fifteen conference delegates from around the world. Attendees ran QGIS 2.6.1 on their own notebooks on the operating system of their choice. Some already use QGIS, some were experiencing QGIS for the first time and some some wanted to compare it with ArcGIS. The course content was guided largely by the QGIS training manual but as we usually do, adapted for the requirements, interests and pace of the class.
How to load a QGIS project in python
Today in a project we are working on we wanted to load a QGIS project. It takes surprisingly few lines of code to make a small standalone application that loads a project and then shows it as a map in a window like this:
A quick hack to select all multipart features in QGIS
Today we wanted to find all the multipart features in this layer:
Kartoza docker-helpers for lazy sysadmins
Docker is really awesome but typing out all those commands can get tedious. I wanted to quickly share a small project on github I made some time back that tries to make your life easier when working with docker. The project is called docker-helpers. It is a collection of bash scripts that give you short cuts to various 'every day' docker commands. Here is a quick listing of the different commands:
Orchestrating GeoServer with Docker and Fig
In this article I will detail how to set up a simple orchestrated system of docker containers using:
Setting up a Fedora 21 QGIS Workstation
I have been a long time Ubuntu user (I have actually been using it since Ubuntu 4.10 'Warty Warthog') - the first official release. The advent of Ubuntu saw an end to my distro hopping whilst looking for the 'perfect linux distro'.
How to build and debug QGIS with QtCreator
Here is how I build QGIS with QtCreator under ubuntu 14.04
Gary Sherman wins the Sol Katz award
This year Gary Sherman won the annual Sol Katz award. To quote the OSGEO page about the award:
WMS Legend Plugin for Leaflet
This weekend I was updating our map gallery at http://maps.kartoza.com and I wanted to have WMS legends in my maps. The maps are mostly generated using QGIS server which also produces a nice looking graphic for its getLegendGraphic requests. Since Leaflet does not seem have a legend control out of the box, I wrote a small leaflet plugin to do it.
Nodeenv: How to install nodejs in a python virtualenv
Here at Kartoza, working in python virtual environments is our default modus operandi when embarking on any python development. For some time we have been enjoying yuglify, tilemill and other node.js based applications as part of our workflow, and early on in my use of these technologies I discovered nodeenv - mainly because I had been bitten on the ass by different node applications on the same host expecting to have different versions of node.js. Nodeenv provides a python virtualenv like environment for sandboxing your node applications so that each can run under its own discrete version of node.js. It operates very much like python virtualenv does and in fact it requires virtualenv so for pythonistas it is a very good fit! In this article I document the steps needed to get node running under such an environment.
Playing with Foreign Data Wrappers in PostgreSQL
Recently I set out to try out the PostgreSQL foreign data wrapper (FDW) because I needed access to data that was in MySQL tables. The main reason I needed to play around was to expose my data to a range of PostgreSQL functions that are better and more recent that MySQL. I also needed to use MySQL data for views and lookups and data-driven styling for some Geoserver layers. FDWs allow remote access to tables or queries from various external third-party databases or file structures.
MyCOE GCE TechCamp
The AAG (American Association of Geographers) and US State Department, through EIS Africa, ran the South Africa edition of the GCE MyCOE Youth TechCamp from 13-23 July 2014. Kartoza and its former incarnation Afrispatial, were brought on board to lead the technical and educational aspects of the TechCamp. The TechCamp was ten days of cultural exchange coupled with hands-on GIS learning around a theme of climate change. The main goal of the programme was to stimulate the role of Geography in the students and to teach how new technologies are advancing the use of Geography in the real world to solve problems.
The excellent team in the Geography Department of the University of Pretoria hosted the TechCamp (see their post), while we all stayed at the Altelekker Youth Camp in Irene. Thirty-seven 15-17-year-old high school students did GIS classes, learnt about climate change issues, listened to guest speakers like Colleen Vogel and Roger Ellis, went on field-trips to Freedom Park, Maropeng, Sterkfontein Caves and Dinokeng and had lots of fun. The students were selected over the previous six months through a competitive process: ten from the USA and the rest from South Africa. Students from both countries came from a range of backgrounds: private and public schools, rural and urban, advantaged and disadvantaged. Some were computer literate and even had won GIS awards, while others had hardly touched a computer. The main aim for integrating these students was to initiate a skills transfer as well as a cultural exchange.
The setting for most of the lectures was the University of Pretoria, which was carefully chosen to stimulate the participants into appreciating what university is all about and also making them aware that Geography can be regarded as a career. The climate change project focussed on water-related issues centred around Centurion Lake: pollution, planning, dolomite and sinkholes. We prepared datasets covering Gauteng, including satellite imagery, a DEM, OpenStreetMap layers, Tshwane Metro layers, geology and other public data. These were provisioned from a central PostGIS database and from Spatialite databases on USB drives. The students learnt the basics of GIS, through to digitising, basic analysis and map composition, all using QGIS. They all took the data and QGIS software home with them to share and distribute.
By the end of the TechCamp the students' computer and GIS skills were phenomenal. They were put to good use in the "TechTorrent" on the last day, where each of eight teams presented the research projects they had been developing all week. Their presentations employed tools such as Prezi and ESRI Storymaps and all contained maps made in QGIS.
with contributions from Admire Nyakudya and Bridget Fleming
How to quickly transform a bounding box from one CRS to another using QGIS
Today I needed to convert a bounding box for a tilemill project that I want to bring into QGIS as a tile layer (more on that in a future post if I get it to work...). I needed to convert a bounding box from EPSG:4326 ('Geographic') coordinates to EPSG:3857 (Spherical Mercator). Fortunately it is a fairly trivial process if you don't mind writing a few lines of python in the QGIS python console:
box = QgsRectangle(-19.6875,-37.9962,59.0625,37.4400)
source_crs = QgsCoordinateReferenceSystem(4326)
dest_crs = QgsCoordinateReferenceSystem(3857)
transform = QgsCoordinateTransform(source_crs, dest_crs)
new_box = transform.transformBoundingBox(box)
new_box.toString()
u'-2191602.4749925746582448,-4578889.0142234507948160 : 6574807.4249777207151055,4500615.8633687794208527'
Running QGIS desktop in a docker container
I love using docker - I have been tracking and learning docker since soon after it was announced and believe it is going to be a real game changer. I've been playing around with the different things one can do in a docker container and of course it is only natural that a 'QGIS guy' such as myself would start to think about using docker with QGIS. QGIS server in a docker container seems like a natural fit, but how about QGIS Desktop? Last night Richard Duivenvoorde and I were sitting around drinking tea and we thought we would give it a quick go - in fact it only took about half an hour to get something working....