Following my post on the opal card visualisation (which still needs some improvements), I thought on doing another map as I have been trying to do some stuff for work. As I mentioned earlier, I like to use mapbox because it gives me the possibility to design my own map (but am still using a default template). Still being pretty new to d3js, I try to find my way around by trying examples but there was not many examples of Mapbox and d3 or to phrase this differently, I was not searching at the right place until I came across blockbuilder. Prior to this discovery, most of the examples I saw were a bit ambiguous to me and a lot of them are related to US maps and converting the shapefile through shp2geo package and I found it a bit too hard for me to actually spend some time doing that for Australian Shapefile. Shapefile was not new to me, but manipulating them was new and challenging.

Australian shapefiles are available on abs. There were few challenges/problems to reach the final visualition. The problems/challenges and their solutions are as follows:

  1. Converting shapefile to geojson.
    Solution: Mapshaper
  2. Map does not load on through mapbox api.
    Findings: CRS was missing in geojson file from mapshaper
    Challenge: shp2geo package did add the crs attribute to the file. Possibly I was doing something wrong.
    Solution: load the shapefile in Qgis and save the shapefile with the crs as geojson.
  3. Slow to render the massive shapefile
    Solution: simplified the shapefile using the Visvalingam weighted area algorithm which makes the appearance smoother by potentially removing points located at the vertex of more acute angles on mapbox, downloaded as shapefile and repeated the Qgis export process.

The loading was much quicker and didn’t affect the detail of the polygons by much. The Map is a fork of Ian Johnson’s block but with additional detail on the color coding. At the moment, its using a random number and changes all the time. However, the plan is to color code it based on the population of that sa4 region. The current iteration of the map accessible here

Until then, keep checking for the update :)

Opal-Vis