This repository records the process and results of preparing Australian suburb and postcode data (particularly for Melbourne and Sydney) for use with jVectorMap.
git clone git://github.com/chrisberkhout/jvectormap_data_au.git
cd jvectormap_data_au
git submodule init && git submodule update
open html/*
This assumes Mac, but the scripts shouldn't be hard to adjust for other UNIX systems.
ls ./fetch-* | xargs -n1 bash -x
The jVectorMap conversion script requires Python and some libraries to be installed. I did this using homebrew to get GDAL support and the default Mac Python installation to install the required Python libraries and run the script. The sequence of commands are documented in a shell script, but I advise reading it and performing the steps manually, rather than just running it:
cat ./setup-python.sh
ls ./generate-* | xargs -n1 bash -x
The files under data-codes/
are tab separated records that map region codes
to names. When using a codes file, the jVectorMap converter script crashes
if the codes file is missing the code of a geometry present in the source
data. I have forked the converter script (as jvectormap-fork/convertor.py
)
so that if a codes file is specified, only the geometries listed in it will
be output.
In addition to allowing codes files to be used to select with geometries to include in the output, the fork fixes a bug which caused only one of several identically named geometries to be output (because a Dictionary of them was being keyed on name (which is not unique) instead of code (which is).
Most of the scripts use the fork rather than the original script from jVectorMap.
The data is from 2006 (except where marked 2011), from the Australian
Bureau of Statistics. The suburb areas are coded according to State
Suburb (SSC) censis divisions. For more information on the data, follow
the links in the fetch-*
scripts.
If you'd like to explore the source data (eg. for inspecting metadata or selecting a range of areas to include in a new codes file), I highly recommend Quantum GIS. It can be installed with homebrew:
brew update
brew tap homebrew/science
brew install libspatialite # this dependency forgotten in qgis recipe
brew install qgis
Opening shapefiles, selecting features and exporting metadata is all pretty easy.
I've included scripts to generate national-level postcode and suburb data, but they don't look good. They could be improved, but data of this detail is probably not a good fit for jVectorMap.
The map data files generated may be a little on the large side. This could be improved by tweaking the simplification parameters of the conversion script.
Take a look at html/postcodes-mel-interactive.html
for an example of coloring
based on data and handling clicks. Theres lots more that can be done with
interactivity in jVectorMap.