WMS Legend Plugin for Leaflet

Posted by: Gavin Fleming | in Leaflet, QGIS | 6 years, 7 months ago | Comments

This weekend I was updating our map gallery at 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

Posted by: Gavin Fleming | 6 years, 7 months ago | Comments

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

Posted by: Gavin Fleming | in Database, FOSSGIS | 6 years, 7 months ago | Comments

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

Posted by: Gavin Fleming | in Education | 6 years, 8 months ago | Comments

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

Posted by: Gavin Fleming | in FOSSGIS, QGIS | 6 years, 8 months ago | Comments

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)
u'-2191602.4749925746582448,-4578889.0142234507948160 : 6574807.4249777207151055,4500615.8633687794208527'


Running QGIS desktop in a docker container

Posted by: Gavin Fleming | in QGIS | 6 years, 9 months ago | Comments

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....

Have any questions? Contact us.
We would love to hear from you!
Subscribe to our Mailing list (spam-free, industry-relevant occasional emails)

Subscribe to our mailing list

* indicates required