Change society, not (only) infrastructure!

A bike lane is used for parking. Kuala Lumpur, summer 2019.

This is an essay I wrote as an exercise for the massive open online course (MOOC) “Unraveling the cycling city”, organised by the Urban Cycling Institute at the University of Amsterdam, that I recently attended in an attempt at active procrastination. I highly recommend the course to anybody who is interested in cycling, urbanism, politics, planning, environmentalism, or social geography (or in all of those, like me). Truly inspiring teachers and carefully curated content. It’s in fact so well-designed, that, that even if you only have an hour or two to invest every evening (as I did), it’s easy to finish even the non-mandatory exercises in the five week duration of the course (despite its rich and comprehensive content) and get all out of it.

It is not simple to name one key takeaway after four weeks of an inspiring course full of interesting material. I found my key takeaway only after looking closely at the notes I took: their overarching theme is the political dimension of the bicycle, of cycling, cycling culture, and cycling infrastructure. It is often argued, also in parts of this course, that for the Dutch, for instance, the bicycle is the self-evident best transport option in many of their everyday journeys. This is, though, only part of a much larger narrative, in which the power balance shifted pro-bicycle due to many favourable factors coinciding.

The success had less to do with Dutch DNA or the country’s flatness than with a combination of factors, including bicycle-friendly representatives, strong bourgeois cultures, urban-planning choices, late automobility, and governmental policies.

Oldenziel & Albert de la Bruhèze 2011:42

From the urbanist perspective, contested spaces and places are the most obvious and overt manifestation of this political dimension of the bicycle. They are indeed an important factor, and for me as a social geographer, the struggle over (re-)production of space will always be a primary theme. That said, there are other, not so inherently spatial, dimensions to it: In its very early days, bicycling was an upper class pasttime, but it quickly became a strong symbol of working class, both as a vehicle for fulfilling transport needs connected to work life, and as an enabler of freedom of mobility. In my home country, Austria, the fascist regime of the 1930s introduced harsh restrictions on bicycles in an effort to weaken the social-democrat opposition. The bicycle had become a strong political symbol.

During the interwar period, when bicycles boomed as everyday devices in the cities, the upper-middle class culturally shifted gears from cycling to promote automobile touring, while many European governments began to treat bicycle traffic as a problem to be solved rather than a solution to be embraced. At the same time, socialist, liberal, and bourgeois reformers pushed the bicycle as an instrument to uplift, discipline, and educate the working classes […].

Oldenziel & de la Bruhèze 2011:33

The Netherlands were lucky to retain a certain burgeois interest in the bicycle, with even the royal family showing themselves on bikes in public. Giselinde Kuipers (2012:25) assesses the result of decades of reproducing cycling culture: “What is most important in habitus formation, however, is that for Durch cyclists, all these associations and backgrounds are largely irrelevant. All Dutch are embedded in a network of conventions, habits and practices to do with cycling that are felt to be self-evident.” Kuipers’ quote makes it sound as if the societal background, the national habitus, formed themselves, but, looking closer, this political success story started out a political struggle with tremendous protests on the streets (cf. van der Zee, 2015).

This struggle continues today – even more so in other countries, where the power relations are not so obviously in favour of cycling. The predominant narrative in North America, as well as many European countries is that of cycling as a leisure activity which naturally should not receive as much attention as the car, the motor of busy people’s economy. The narrative further includes a notion of the cyclist as more prone to illegal activities. This is simply not true, with most of the few occasions of rule-breaking attributable to insufficient infrastructure (cf. Marshall et al. 2016). To overcome this, scholars recommend a cycling perspective in urban design and traffic planning (Forsyth & Krizek, 2011; Bertolini & le Clerq, 2002) and a turn away from copying automotive design patterns (Liu et al. 2019; te Brömmelstroet et al. 2018). These efforts, unfortunately, often have the air of preaching to the choir; they don’t seem to reach behind the windshields of decision-makers who often are within easy reach of other lobbies.

I want to argue for a change in the strategy and priorities of bicycle advocacy. The Dutch example is quite clear, in fact: first a favourable political situation emerged, that led, second, to improved infrastructure (which in turn helped further shape political and societal conditions). In Finland, where I currently live, cars are number one priority for traffic planning, and motorists think of themselves as the (only) rightful owners of the road. Shouldn’t we put much more effort into trying to change this mindset and establish a societal consense on the meaningfulness of sustainable urban transport? Advocating for cycling infrastructure in an auto society will always be politics of small steps, its results mere afterthoughts to car roads. The successful examples of sustainable urban transport are in places that managed to change the fundamental narrative: in The Netherlands and in Copenhagen, cyclists are not only sportists, hippies and radical rule-breakers.

Let’s take the auto out of auto society elsewhere, too!


Cartogram Plugin for QGIS3

QGIS3 is coming (winter is leaving). And it’s going to be harder, better, faster, stronger. America first, QGIS second!

Seriously, now. QGIS 3.0 is the upcoming next major version of QGIS, and it means a significant change to the ecosystem the open source GIS has built up over the last decade. That is good and healthy – APIs tend to become inconsistent and cluttered when they grow, dependencies see new major versions (and API/ABI changes), and a careful but thorough spring cleaning has not done nearly as much damage as eight year-old me claimed when I had to sort out my toys. Python 3 and Qt 5 have been around for quite a while now, after all.

But in certain ways it remains a challenge, especially for the mostly voluntary developers of the –as of today– 719 plugins in the project’s plugin repository (plus the numerous un(der)published ones). While the changes between Python 2 and Python 3 are a) not so extensive, b) have been known for years and c) (could) have been defanged by writing code suitable for both versions alike, PyQt5 brings more severe changes under its hood. The most challenging changes, though, clearly come from QGIS’ pyqgis API changing. No wonder, it has been growing tremendously since its last major release 2.0, back in 2013. Nyall Dawson wrote a good heads-up of the changes and how fundamental some of them are going to be.

Curiosity is big in me: one way that manifests is that I always (always!) have to try to build the newest versions of any software I am using. You’ll never find an outdated version of, say, GDAL on any of my computers. No, sir! No can do. So recently I thought it might be time for having a QGIS which uses Qt5 and Python3 – maybe I could even get rid of all that Qt4 clutter on my installation and switch to Python 3 for good! (spoiler alarm: nah, still takes its while)

And then that: There’s a total of 17 plugins available for QGIS 3. Seventeen! Out of seven hundred! Of course zero of my favourites.

For austromorph I had heavily tweaked the cartogram plugin, originally authored by Carson Farmer, later enhanced by Morten Wulff, and had added rudimentary parallel processing and a simple batch processing capability. As heavily it was tweaked, as ugly the code looked afterwards. I would not have published that piece at any price (even tough other users might have liked my additions). I have had plans of rewriting the whole plugin for a while, as I saw some room for improvements in performance. Since at austromorph we use the plugin to compute animation frames for our animated morphing maps, any speed-up would be a great enhancement.

I am proud to present to you The All New cartogram3 plugin for QGIS 3. Coming to your home straight from Vienna, Austria, it is a complete rewrite which draws in parts on the previous cartogram plugins, but brings major improvements in performance and adds some nifty new features.

Let me walk you through it:

  • First, you install it from QGIS’ extension manager (Plugins→Manage and Install Plugins)
    That was easy!
  • Then you open up any polygon layer you have laying (höhö!) around. Check that it has one variable which is an absolute count of something, like for instance humans. I use this gorgeous dataset of People on and in between Mountains, or as others tend to call it Population Numbers of Austria.

  • Run the plugin. Select which layer you want to compute a cartogram of, and choose one or more attributes for batch processing. Then, define stop conditions: since the algorithm is iterative, the results get gradually better with every repetition. The more iterations, the better; but also: the more iterations, the longer the computation time. We recommend an absolute minimum of 10 iterations. If the requested quality is met earlier, i.e. the average areal error of the cartogram is smaller than the set value, the computation stops earlier.

  • Now, your computer needs to have power™ and/or stamina® – the computation takes from split seconds to –quite literally– ages, depending on the computer and the dataset. The algorithm iterates over every point × every polygon, and thus scales extremely poorly. Consider simplifying your input dataset beforehand.
    But worry not: you can alway hit cancel and start over.
  • And finally, you should have a shiny result:

Be sure to try it out as soon as you get hold of QGIS>=3! There’s a sample dataset included (optimised to compute muy rapido)

Helsinki Street Casting: a Google Apps Script love story

For my good friend Katri at Helsinki Street Casting I recently developed an online casting form which has some clever features underneath an elegantly modest hood. The specifications seemed easy at first: integrate the form into an existing Squarespace page, have the response recorded in a Google spreadsheet and the uploaded photos put into a Google Drive folder.

Katri previously used an <iframe> from Form Plus, which posed three problems: first, it was ugly, and did not at all go well with the page’s over-all style. Second, being trapped inside an <iframe>, it did not display well on mobile or tablet devices. And third, it would cause an extra cost for a still not optimal solution as soon as the number of users would rise even moderately.

Being a rookie to Google Apps Script, I searched for accounts of how others had realised similar endeavours. The API documentation is excellent, and it’s easy to find various other web pages detailing how they tackled the problem. Just send a form data to your published Google Apps Script web app, implement a doPost(request) function, and you’re set. It seemed almost too easy!

Of course it was not so easy. Turns out, that gapps scripts only accept <input type="file"> POST-data if the form is served from the same apps script instance. So back to using an <iframe>? No way!

The solution was to employ a FileReader instance on the client side, and submit a base64-encoded string in a <input type="text">:

On top of that, the final implementation resizes the submitted images using a canvas object to limit the upload payload, and to display a preview before uploading. Also it assembles the form payload into a JavaScript object rather than submitting the serialised <form>.

This is not 100% “progressive enhancement”, because it does not work in case JavaScript is disabled, or no FileReader class is available. The support in current web browsers is excellent, so the latter should not be a great deal. For the former a noscript block notifiying the user proved to be an adequate workaround.

In its final form, the form (haha!) comprises one long copy&paste block with inline CSS and JS to be pasted into the Squarespace editor, a similar blob to go into a new Google Apps Script project, and a template spreadsheet.

The final page looks like that:
Helsinki Street Casting

Go check it out at or

Euler to Axis-Angle converter

In the past days I got myself acquainted with the astonishingly efficient parametric computer-aided design (CAD) system FreeCAD. It’s open source, so be sure to check it out!

The idea behind how a parametric CAD like FreeCAD works is elegant, yet in practice it poses challenges to developers and novice users: Any single object is described by parameters, constraints and its relationship to other objects. Even if the object is involved in a boolean operation, such as a fusion or a cut-out, be it as the base object or the “tool” object, all original values are retained, and the object itself is held accessible to the user. Let me give you an example to illustrate one case where parametric modelling shows its outstanding features: drillholes, represented by cylinders, in a cube, representing a board of wood. You can at any time access the cylinder objects and change their radius, position, and rotation (and many more parameters).

To sum this up: I am incredibly impressed and overwhelmed by FreeCAD.

There’s just this one thing my mind has a hard time picturing: angle-axis representation of rotations, aka quaternions. Anybody who dealt with any recent 3D engine, be it in game development or in engineering, has come across it. Basically, a rotation is not described by its component rotations around three axis; instead a (normal) vector describes a rotation plane, an angle the rotation in this plane. Probably everybody else in this world has this figured out – I myself have a hard time converting from one to another in my head.

Finding a way to save my brain a bit of pain, and myself some time otherwise used up in trial-and-error attempts of finding the right values, I stumbled upon Martin John Baker’s excellent page on euclidean space, which also offered an easy conversion applet. The culprit? It’s an applet – like in “Java applet”. Hardly any up-to-date browser supports it fully, I had to add security exception rules to my Java VM installation, and click through five-ish warnings each time I wanted to use it.

That’s why I used Martin’s excellent explanation of the formulas for converting between the representations to create a spreadsheet which does exactly the same thing as the applet (short of the nifty airplane turning its nose).

Feel free to use it either here in the iFrame below or directly in Google Docs.

I am very proud to present to you a joint project of Michael Holzapfel, Ramon Bauer and me: is dedicated to anamorphic maps of Austria. Anamorphic maps are maps in which the square area of a geographical feature is related to a thematic value. If for instance the areal size of municipalities is adjusted by their population, large cities, usually not much more than small dots in the map, would become more prominently represented, while rural communities with large are but few inhabitants would shrink.

Our prime motivation are the preliminary maps of the results of the first round of the ongoing elections for the Austrian federal president. One candidate could win the support of mostly urban voters, the other one has a strong standing in rural areas. The maps TV, news papers and magazines showed, were suggesting a wrong image: Most of the country was painted in the colours of the candidate with rural support, the urban areas left a mere splotches of green in a sea of blue.

We resized the municipalities to represent their respective number of eligible voters, and –voìla!– the map looks a lot more balanced.

The maps are provided in a Creative Commons Attribution-ShareAlike 4.0 License, each individual map offers embedding code snippets. See an embedded map live in Ramon’s blog post “Austria, how blue can you go?”!

While we certainly will cover the second round of this election, we want to pick up the momentum and keep publishing maps on a more or less regular basis.

Update June 2016: As it seems we are continuing the election maps for a while longer. Stay tuned!