Since it was trivial to calculate the centre of the city, I thought I’d do something a little more complex: calculate the centre of the city, weighted for population. I scraped the 2006 population data by ward from the City of Toronto: Ward Profiles pages; hooray for curl and regexes. Realising that I had no information on population distribution within wards, I made a good old engineering assumption: we could idealize the population as a point mass at the centroid of each ward, and then calculate the centre of mass by balancing moments around the X and Y axis. (I mean, c’mon – it’s the sort of thing we all think about daily … isn’t it? Guys … hello … anyone there?)
I’ll spare you the details until after the jump, but I calculate the human centre of Toronto to be at 43.717794°N, 79.390299°W – that’s in Blythwood Ravine, just south of Blythwood Road. We should have a picnic there …
I’ve transformed all the Open Toronto data into the one CRS, UTM Zone 17 NAD83(CSRS), aka EPSG 2958. Combining the ward centroids with the population data, we get:
| ward |
xcentre |
ycentre |
2006 population |
| 1 |
613061.3 |
4844146.6 |
59830 |
| 2 |
614805.5 |
4840302.0 |
53660 |
| 3 |
615174.7 |
4834294.6 |
50415 |
| 4 |
617768.5 |
4836958.9 |
53275 |
| 5 |
618929.9 |
4832315.2 |
57260 |
| 6 |
619572.4 |
4829261.3 |
56620 |
| 7 |
617472.3 |
4844566.8 |
49165 |
| 8 |
620979.9 |
4846977.1 |
47895 |
| 9 |
622033.3 |
4843760.4 |
44920 |
| 10 |
624905.2 |
4846553.0 |
61580 |
| 11 |
620766.3 |
4838224.8 |
59870 |
| 12 |
622055.6 |
4840047.1 |
53755 |
| 13 |
622735.3 |
4834354.9 |
50640 |
| 14 |
625449.4 |
4833661.4 |
50640 |
| 15 |
624880.8 |
4841050.4 |
60545 |
| 16 |
627581.4 |
4842532.8 |
51790 |
| 17 |
624903.7 |
4837407.9 |
50830 |
| 18 |
625917.3 |
4834970.2 |
45620 |
| 19 |
627681.1 |
4834083.5 |
49845 |
| 20 |
629103.3 |
4834749.5 |
59545 |
| 21 |
626934.8 |
4838564.6 |
47085 |
| 22 |
629222.9 |
4839354.9 |
59905 |
| 23 |
627289.9 |
4847806.5 |
79435 |
| 24 |
630438.7 |
4850084.3 |
58805 |
| 25 |
630699.0 |
4844136.6 |
55420 |
| 26 |
632936.3 |
4841208.7 |
60585 |
| 27 |
630518.7 |
4836915.8 |
67840 |
| 28 |
631290.6 |
4833067.2 |
58920 |
| 29 |
633153.2 |
4838703.6 |
44420 |
| 30 |
633874.3 |
4835110.5 |
51235 |
| 31 |
636074.0 |
4839975.7 |
52430 |
| 32 |
636535.9 |
4836957.3 |
55410 |
| 33 |
632984.6 |
4848926.5 |
57350 |
| 34 |
634520.4 |
4844926.9 |
56895 |
| 35 |
639025.5 |
4841743.5 |
56750 |
| 36 |
641455.1 |
4841624.3 |
51390 |
| 37 |
638364.8 |
4845440.1 |
62325 |
| 38 |
641766.3 |
4847162.9 |
63310 |
| 39 |
635724.0 |
4851688.8 |
54545 |
| 40 |
636386.0 |
4848580.4 |
61140 |
| 41 |
639199.5 |
4851985.8 |
67325 |
| 42 |
644298.3 |
4853536.7 |
74075 |
| 43 |
644624.2 |
4847389.2 |
53480 |
| 44 |
648030.9 |
4849745.2 |
58235 |
To get the weighted average we simply divide the sum of (ward centre * population) by the sum of the population. Transforming the numbers back using invproj gets us the geographic coordinate of the centre point. Easy when you’ve no idea what you’re doing …
No related posts.
Related posts brought to you by Yet Another Related Posts Plugin.
Since it was trivial to calculate the centre of the city, I thought I'd do something a little more complex: calculate the centre of the city, weighted for population. I scraped the 2006 population data by ward from the City of Toronto: Ward Profiles pages; hooray for curl and regexes. Realising that I had no information on population distribution within wards, I made a good old engineering assumption: we could idealize the population as a point mass at the centroid of each ward, and then calculate the centre of mass by balancing moments around the X and Y axis. (I mean, c'mon - it's the sort of thing we all think about daily ... isn't it? Guys ... hello ... anyone there?)
I'll spare you the details until after the jump, but I calculate the human centre of Toronto to be at 43.717794°N, 79.390299°W - that's in Blythwood Ravine, just south of Blythwood Road. We should have a picnic there ...
[osm_map lat="43.717794" long="-79.390299" zoom="16" width="600" height="450" marker="43.717794,-79.390299" marker_name="wpttemp-red.png"]
I've transformed all the Open Toronto data into the one CRS, UTM Zone 17 NAD83(CSRS), aka EPSG 2958. Combining the ward centroids with the population data, we get:
ward
xcentre
ycentre
2006 population
1
613061.3
4844146.6
59830
2
614805.5
4840302.0
53660
3
615174.7
4834294.6
50415
4
617768.5
4836958.9
53275
5
618929.9
4832315.2
57260
6
619572.4
4829261.3
56620
7
617472.3
4844566.8
49165
8
620979.9
4846977.1
47895
9
622033.3
4843760.4
44920
10
624905.2
4846553.0
61580
11
620766.3
4838224.8
59870
12
622055.6
4840047.1
53755
13
622735.3
4834354.9
50640
14
625449.4
4833661.4
50640
15
624880.8
4841050.4
60545
16
627581.4
4842532.8
51790
17
624903.7
4837407.9
50830
18
625917.3
4834970.2
45620
19
627681.1
4834083.5
49845
20
629103.3
4834749.5
59545
21
626934.8
4838564.6
47085
22
629222.9
4839354.9
59905
23
627289.9
4847806.5
79435
24
630438.7
4850084.3
58805
25
630699.0
4844136.6
55420
26
632936.3
4841208.7
60585
27
630518.7
4836915.8
67840
28
631290.6
4833067.2
58920
29
633153.2
4838703.6
44420
30
633874.3
4835110.5
51235
31
636074.0
4839975.7
52430
32
636535.9
4836957.3
55410
33
632984.6
4848926.5
57350
34
634520.4
4844926.9
56895
35
639025.5
4841743.5
56750
36
641455.1
4841624.3
51390
37
638364.8
4845440.1
62325
38
641766.3
4847162.9
63310
39
635724.0
4851688.8
54545
40
636386.0
4848580.4
61140
41
639199.5
4851985.8
67325
42
644298.3
4853536.7
74075
43
644624.2
4847389.2
53480
44
648030.9
4849745.2
58235
To get the weighted average we simply divide the sum of (ward centre * population) by the sum of the population. Transforming the numbers back using invproj gets us the geographic coordinate of the centre point. Easy when you've no idea what you're doing ...
This is really cool! What kind of GIS software are you using?
Pingback: Toronto’s Human Centre, part 2: by neighbourhood « Numpty's Progress
Pingback: current tools of my trade « Numpty's Progress