]> git.vanrenterghem.biz Git - www2.vanrenterghem.biz.git/blob - posts/spatial_indexes_to_plot_income_per_postal_code_in_Australian_cities.org
Voeg alle posts toe.
[www2.vanrenterghem.biz.git] / posts / spatial_indexes_to_plot_income_per_postal_code_in_Australian_cities.org
1 #+date: 2017-11-16 15:07:59 +0800
2 #+filetags: R spatial analysis visualisation Australia git
3 #+title: Spatial indexes to plot income per postal code in Australian cities.
5 Trying to plot the income per capita in Australia on a map, I came
6 across a perfectly good reason to make good use of [[a spatial
7 query|http://r-spatial.org/r/2017/06/22/spatial-index.html]] in R.
9 I had to combine a shapefile of Australian SA3's, a concept used under
10 the Australian Statistical Geography Standard meaning Statistical Area
11 Level 3, with a dataset of income per postal code. I created a matrix of
12 intersecting postal codes and SA3's, and obtained the desired income per
13 capita by SA3 performing a matrix multiplication. If the geographical
14 areas were perfectly alignable, using a function like =st_contains=
15 would have been preferred. Now I fell back on using =st_intersects=,
16 which results in possibly assigning a postal code to 2 different
17 statistical areas. Alternative approaches are welcome in the comments!
19 As Australia is so vast, and the majority of its people are earning a
20 living in a big city, a full map does not show the difference in income
21 per area at this level of detail. Instead, I opted to map some of the
22 key cities in a single image.
24 #+CAPTION: Income distribution in major AU cities
25 #+ATTR_HTML: :class img-fluid :alt Income distribution in major AU cities
26 [[file:assets/AUCitiesIncomeDistribution.gif]]
28 The full code is available on my git server for you to clone using
29 =git clone git://git.vanrenterghem.biz/R/project-au-taxstats.git=.