The Boundary Mapper’s Cookbook

Dots on maps don’t always tell you the full story behind the numbers.  In cases where you’ve got postcode, suburb or council based data – you’ll want to be able to map those boundaries to tell a richer story than text, numbers or dots can do.

Here’s a quick and dirty guide to getting up and running with boundary data just in time for GovHack:

1 – Install PostgreSQL 9.1 : http://www.enterprisedb.com/products-services-training/pgdownload

2 – Install PostGIS 2.0 : http://www.postgis.org/download/  (there are now 64bit binaries for those who want serious spatial power)

3 – Download some Shapefile (SHP) formatted boundary data and load it into PostGIS (there’s a GUI – PostGIS Shapefile and DBF Loader 2.0 – inside the PostgreSQL Admin Console).  If you’ve got another format there are OS tools you can use – try OGR2OGR (handy guide here)

4 – Download some data to go with those lovely boundaries – e.g. some juicy hot off the press ATO Tax data

5 – Install PHP 5.3 on your web server with the PostgreSQL PDO drivers : http://php.net/downloads.php

6 – Download the PostGIS RESTful Web Service Framework 1.1 (PRWSF)

7 – Edit the PRWSF /inc/database.inc.php file to set your PostgreSQL database connection

8 – Download Leaflet Javascript API

9 – Get a Cloudmade account for a free API key to access to an OpenStreetMap tile layer of your choice

10 – Edit the PRWSF /v1/ws_geo_attributequery.php file to support callbacks for cross domain JSON:

     echo $_GET[‘jsoncallback’] . ‘(‘;

                require_once(“../inc/format.inc.php”);

    echo ‘)’;

11 – Leech some code from GitHub

FYI – the ABS has a rich collection of boundaries for you to use under Creative Commons licensing.  This links directly to their own stats as well as the stats of many other agencies and organisation, such as the ATO (who recently released a tonne of tax data!).  This data is ripe for rich visualisation:

http://www.abs.gov.au/websitedbs/D3310114.nsf/home/ABS+Geography+Publications#Anchor8

Note: 2006 Census data uses he ASGC boundaries.  2011 Census data will use the ASGS bdys when the data is released on June 21.

LeafletTest
Here’s one I prepared earlier…

2 thoughts on “The Boundary Mapper’s Cookbook”

Leave a comment