This is a map of the Australian state of Victoria, showing some of the locations for which cat registration data is available publicly. A bigger cat on the map means there are more real cats in that postcode; pan and zoom to explore.
You might say it's a map of cats, or a CatMap!
Take a shapefile of "postal areas" from the Australian Bureau of Statistics. Using GDAL, find the postcodes in Victoria (starting with 3), and convert to GeoJSON. Then, run through TopoJSON for fancy lossless compression, and run our own postcode-centroids.js
to generate display positions.
ogr2ogr -f GeoJSON -simplify 0.01 -where "SUBSTR(POA_CODE16, 1, 1) = '3'" victoria.geojson POA_2016_AUST.shp
node_modules/.bin/topojson -o victoria.json victoria.geojson
node postcode-centroids.js victoria.geojson
We want to collect data that has cats, and postcodes. In our case we have the City of Ballarat and the City of Greater Dandenong. Some spreadsheet trickery is required to convert things to consistent format (e.g. converting month of birth -> age) and put them in a single file for ease of consumption.
First we draw the base map from the TopoJSON file using The Functions Formerly Known As "d3.geo", with an added splash of d3.zoom to make it look more like a real web map.
Then we load the CSV file containing cat data; for each postcode, we count the number of cats, and add a
There are, of course, not enough cats. NEED MOAR DATA!
https://cdnjs.cloudflare.com/ajax/libs/topojson/1.6.20/topojson.js
https://d3js.org/d3.v4.min.js