{"id":44,"date":"2013-03-10T21:22:05","date_gmt":"2013-03-10T21:22:05","guid":{"rendered":"http:\/\/www.lincoln.ac.nz\/conversation\/gis\/?p=44"},"modified":"2023-05-07T04:22:13","modified_gmt":"2023-05-07T04:22:13","slug":"mapping-the-census","status":"publish","type":"post","link":"https:\/\/blogs.lincoln.ac.nz\/gis\/mapping-the-census\/","title":{"rendered":"Mapping the Census"},"content":{"rendered":"<p><em>In this post I&#8217;ll take about how we can make the most of the recent (and previous) census data and how to add spreadsheet data to a map.<\/em><\/p>\n<p>So did you fill in your census form on Tuesday night? \u00a0In the course of filling in the forms, you no doubt entered a lot of personal information about you and whoever you share a dwelling with. \u00a0Those data provide the government with a hugh amount of demographic data on where people are, how much money they make, what level of education they have, whether they smoke or not, what religion they follow, and the list goes on. \u00a0In between when you submit your forms and when the data are released, a subtle process of aggregation occurs. \u00a0Your personal information gets\u00a0aggregated\u00a0into various levels so that the results can be presented in spreadsheets and maps. \u00a0When the results are compiled they are made available in Excel spreadsheets from the <a href=\"http:\/\/www.stats.govt.nz\/\" target=\"_blank\" rel=\"noopener\">Statistics New Zealand<\/a> website. \u00a0Your personal information can&#8217;t be found but you can see where you fit in with people who live around you. \u00a0Here&#8217;s an example of the spreadsheet from the most recent census (2006):<\/p>\n<p><a href=\"https:\/\/d-blogs.lincoln.ac.nz\/gis\/wp-content\/uploads\/sites\/3\/2013\/03\/CensusSpreadsheet1.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-753\" src=\"https:\/\/d-blogs.lincoln.ac.nz\/gis\/wp-content\/uploads\/sites\/3\/2013\/03\/CensusSpreadsheet1.jpg\" alt=\"CensusSpreadsheet1\" width=\"1429\" height=\"857\" srcset=\"https:\/\/blogs.lincoln.ac.nz\/gis\/wp-content\/uploads\/sites\/3\/2013\/03\/CensusSpreadsheet1.jpg 1429w, https:\/\/blogs.lincoln.ac.nz\/gis\/wp-content\/uploads\/sites\/3\/2013\/03\/CensusSpreadsheet1-300x180.jpg 300w, https:\/\/blogs.lincoln.ac.nz\/gis\/wp-content\/uploads\/sites\/3\/2013\/03\/CensusSpreadsheet1-1024x614.jpg 1024w, https:\/\/blogs.lincoln.ac.nz\/gis\/wp-content\/uploads\/sites\/3\/2013\/03\/CensusSpreadsheet1-768x461.jpg 768w\" sizes=\"auto, (max-width: 1429px) 100vw, 1429px\" \/><\/a><\/p>\n<p>This particular page is from the families spreadsheet (one of seven) and shows the breakdown of families on a region by region basis. \u00a0Note the tabs at the bottom &#8211; each sheet is linked to area units against which the data are presented, from the regional scale (RC) to territorial authorities (TA) to wards (roughly suburbs) to area units (not quite sure what those are to be honest) and down to the finest resolution &#8211; meshblocks (MB). \u00a0At the top level there are 15 regions; at the meshblock level there are 41,381! \u00a0The intriguing thing about all this is that we should be able to map any of the census data to one of those spatial levels. \u00a0But how do we do so? \u00a0Spreadsheets aren&#8217;t maps. \u00a0Happily, StatsNZ has made the spatial data behind those levels available for free so at the very least we can map the areas. \u00a0But we need some way to link together the spreadsheets and the data layers. \u00a0Here&#8217;s an image of the regions layer:<\/p>\n<p><a href=\"https:\/\/d-blogs.lincoln.ac.nz\/gis\/wp-content\/uploads\/sites\/3\/2013\/03\/RegionsMap.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-754\" src=\"https:\/\/d-blogs.lincoln.ac.nz\/gis\/wp-content\/uploads\/sites\/3\/2013\/03\/RegionsMap.jpg\" alt=\"RegionsMap\" width=\"1431\" height=\"897\" srcset=\"https:\/\/blogs.lincoln.ac.nz\/gis\/wp-content\/uploads\/sites\/3\/2013\/03\/RegionsMap.jpg 1431w, https:\/\/blogs.lincoln.ac.nz\/gis\/wp-content\/uploads\/sites\/3\/2013\/03\/RegionsMap-300x188.jpg 300w, https:\/\/blogs.lincoln.ac.nz\/gis\/wp-content\/uploads\/sites\/3\/2013\/03\/RegionsMap-1024x642.jpg 1024w, https:\/\/blogs.lincoln.ac.nz\/gis\/wp-content\/uploads\/sites\/3\/2013\/03\/RegionsMap-768x481.jpg 768w\" sizes=\"auto, (max-width: 1431px) 100vw, 1431px\" \/><\/a><\/p>\n<p>(This layer includes areas out to 23 km offshore.) \u00a0To make this work, there needs to be a common attribute between the spreadsheets and the spatial layers. \u00a0If you look at the spreadsheet image above, you&#8217;ll see the &#8220;Regional Council Code (2006 Areas)&#8221; at the left hand side. \u00a0If we look in the attribute table for the regions, you&#8217;ll see there&#8217;s a similar number:<\/p>\n<p><a href=\"https:\/\/d-blogs.lincoln.ac.nz\/gis\/wp-content\/uploads\/sites\/3\/2013\/03\/RegionsTable.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-755\" src=\"https:\/\/d-blogs.lincoln.ac.nz\/gis\/wp-content\/uploads\/sites\/3\/2013\/03\/RegionsTable.jpg\" alt=\"RegionsTable\" width=\"571\" height=\"476\" srcset=\"https:\/\/blogs.lincoln.ac.nz\/gis\/wp-content\/uploads\/sites\/3\/2013\/03\/RegionsTable.jpg 571w, https:\/\/blogs.lincoln.ac.nz\/gis\/wp-content\/uploads\/sites\/3\/2013\/03\/RegionsTable-300x250.jpg 300w\" sizes=\"auto, (max-width: 571px) 100vw, 571px\" \/><\/a><\/p>\n<p>You&#8217;ll note that we actually have two attributes we can work with &#8211; &#8220;REGC_NO&#8221; and &#8220;REG_NAME&#8221;. \u00a0So in theory we can use these common values to link together the data in the spreadsheet with the map layer. \u00a0Before we can do so, though, we&#8217;ve got to make some changes to the spreadsheet before we add it to the map. \u00a0To add data like spreadsheets to our map, the first row should consist only of headers (field names) and entries should have no spaces, so I&#8217;ve had to make some changes to that sheet. \u00a0To keep it simple I&#8217;m just going to show the first few fields; total number of families and then the breakdown by family type:<\/p>\n<p><a href=\"https:\/\/d-blogs.lincoln.ac.nz\/gis\/wp-content\/uploads\/sites\/3\/2013\/03\/NewSpreadsheet.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-756\" src=\"https:\/\/d-blogs.lincoln.ac.nz\/gis\/wp-content\/uploads\/sites\/3\/2013\/03\/NewSpreadsheet.jpg\" alt=\"NewSpreadsheet\" width=\"1280\" height=\"563\" srcset=\"https:\/\/blogs.lincoln.ac.nz\/gis\/wp-content\/uploads\/sites\/3\/2013\/03\/NewSpreadsheet.jpg 1280w, https:\/\/blogs.lincoln.ac.nz\/gis\/wp-content\/uploads\/sites\/3\/2013\/03\/NewSpreadsheet-300x132.jpg 300w, https:\/\/blogs.lincoln.ac.nz\/gis\/wp-content\/uploads\/sites\/3\/2013\/03\/NewSpreadsheet-1024x450.jpg 1024w, https:\/\/blogs.lincoln.ac.nz\/gis\/wp-content\/uploads\/sites\/3\/2013\/03\/NewSpreadsheet-768x338.jpg 768w\" sizes=\"auto, (max-width: 1280px) 100vw, 1280px\" \/><\/a><\/p>\n<p>So the first row contains the field names and there are no spaces in those names. \u00a0I can now add the spreadsheet to my map just like any other layer.<\/p>\n<p><a href=\"https:\/\/d-blogs.lincoln.ac.nz\/gis\/wp-content\/uploads\/sites\/3\/2013\/03\/AddSpreadsheet.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-757\" src=\"https:\/\/d-blogs.lincoln.ac.nz\/gis\/wp-content\/uploads\/sites\/3\/2013\/03\/AddSpreadsheet.jpg\" alt=\"AddSpreadsheet\" width=\"1436\" height=\"857\" srcset=\"https:\/\/blogs.lincoln.ac.nz\/gis\/wp-content\/uploads\/sites\/3\/2013\/03\/AddSpreadsheet.jpg 1436w, https:\/\/blogs.lincoln.ac.nz\/gis\/wp-content\/uploads\/sites\/3\/2013\/03\/AddSpreadsheet-300x179.jpg 300w, https:\/\/blogs.lincoln.ac.nz\/gis\/wp-content\/uploads\/sites\/3\/2013\/03\/AddSpreadsheet-1024x611.jpg 1024w, https:\/\/blogs.lincoln.ac.nz\/gis\/wp-content\/uploads\/sites\/3\/2013\/03\/AddSpreadsheet-768x458.jpg 768w\" sizes=\"auto, (max-width: 1436px) 100vw, 1436px\" \/><\/a><\/p>\n<p>Next step is to &#8220;Join&#8221; the spreadsheet table to the regions layer. \u00a0To do so, I&#8217;ll right-click on the regions layer, and go to Joins and Relates &gt; Join. \u00a0I could use either the region number or the region name to link &#8211; doesn&#8217;t really matter in this case, but I&#8217;ll use the number here:<\/p>\n<p><a href=\"https:\/\/d-blogs.lincoln.ac.nz\/gis\/wp-content\/uploads\/sites\/3\/2013\/03\/JoinWindow.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\" size-full wp-image-758 aligncenter\" src=\"https:\/\/d-blogs.lincoln.ac.nz\/gis\/wp-content\/uploads\/sites\/3\/2013\/03\/JoinWindow.jpg\" alt=\"JoinWindow\" width=\"418\" height=\"604\" srcset=\"https:\/\/blogs.lincoln.ac.nz\/gis\/wp-content\/uploads\/sites\/3\/2013\/03\/JoinWindow.jpg 418w, https:\/\/blogs.lincoln.ac.nz\/gis\/wp-content\/uploads\/sites\/3\/2013\/03\/JoinWindow-208x300.jpg 208w\" sizes=\"auto, (max-width: 418px) 100vw, 418px\" \/><\/a><\/p>\n<p>When I click OK, all the attributes in my spreadsheet table get added to my map layer and then I can use these new attributes to map the data:<\/p>\n<p><a href=\"https:\/\/d-blogs.lincoln.ac.nz\/gis\/wp-content\/uploads\/sites\/3\/2013\/03\/PopulationMap.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-759\" src=\"https:\/\/d-blogs.lincoln.ac.nz\/gis\/wp-content\/uploads\/sites\/3\/2013\/03\/PopulationMap.jpg\" alt=\"PopulationMap\" width=\"1432\" height=\"856\" srcset=\"https:\/\/blogs.lincoln.ac.nz\/gis\/wp-content\/uploads\/sites\/3\/2013\/03\/PopulationMap.jpg 1432w, https:\/\/blogs.lincoln.ac.nz\/gis\/wp-content\/uploads\/sites\/3\/2013\/03\/PopulationMap-300x179.jpg 300w, https:\/\/blogs.lincoln.ac.nz\/gis\/wp-content\/uploads\/sites\/3\/2013\/03\/PopulationMap-1024x612.jpg 1024w, https:\/\/blogs.lincoln.ac.nz\/gis\/wp-content\/uploads\/sites\/3\/2013\/03\/PopulationMap-768x459.jpg 768w\" sizes=\"auto, (max-width: 1432px) 100vw, 1432px\" \/><\/a><\/p>\n<p>We&#8217;ll go one step further with this mapping &#8211; the data also include the breakdown of families by couples with and without children, and one parent with children. \u00a0I&#8217;ll show these as pie charts for each region but will zoom in on Canterbury to have a closer look (Look for the Charts option on the Symbology tab):<\/p>\n<p><a href=\"https:\/\/d-blogs.lincoln.ac.nz\/gis\/wp-content\/uploads\/sites\/3\/2013\/03\/PieChart.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-760\" src=\"https:\/\/d-blogs.lincoln.ac.nz\/gis\/wp-content\/uploads\/sites\/3\/2013\/03\/PieChart.jpg\" alt=\"PieChart\" width=\"1435\" height=\"858\" srcset=\"https:\/\/blogs.lincoln.ac.nz\/gis\/wp-content\/uploads\/sites\/3\/2013\/03\/PieChart.jpg 1435w, https:\/\/blogs.lincoln.ac.nz\/gis\/wp-content\/uploads\/sites\/3\/2013\/03\/PieChart-300x179.jpg 300w, https:\/\/blogs.lincoln.ac.nz\/gis\/wp-content\/uploads\/sites\/3\/2013\/03\/PieChart-1024x612.jpg 1024w, https:\/\/blogs.lincoln.ac.nz\/gis\/wp-content\/uploads\/sites\/3\/2013\/03\/PieChart-768x459.jpg 768w\" sizes=\"auto, (max-width: 1435px) 100vw, 1435px\" \/><\/a><\/p>\n<p>Note that I can set it so that the diameter scales with the total population, so Canterbury&#8217;s population being larger than the West Coast&#8217;s is reflected by its size and the rough breakdown between the different classes is shown by the pie chart.<\/p>\n<p>So now, any data included in the census can be mapped reasonably easily at several different scales. \u00a0Earlier I mentioned the meshblocks being the finest scale. \u00a0Here&#8217;s an image of the Christchurch meshblocks mapped to show populations.<\/p>\n<p><a href=\"https:\/\/d-blogs.lincoln.ac.nz\/gis\/wp-content\/uploads\/sites\/3\/2013\/03\/ChristchurchPopulations.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-761\" src=\"https:\/\/d-blogs.lincoln.ac.nz\/gis\/wp-content\/uploads\/sites\/3\/2013\/03\/ChristchurchPopulations.jpg\" alt=\"ChristchurchPopulations\" width=\"1429\" height=\"862\" srcset=\"https:\/\/blogs.lincoln.ac.nz\/gis\/wp-content\/uploads\/sites\/3\/2013\/03\/ChristchurchPopulations.jpg 1429w, https:\/\/blogs.lincoln.ac.nz\/gis\/wp-content\/uploads\/sites\/3\/2013\/03\/ChristchurchPopulations-300x181.jpg 300w, https:\/\/blogs.lincoln.ac.nz\/gis\/wp-content\/uploads\/sites\/3\/2013\/03\/ChristchurchPopulations-1024x618.jpg 1024w, https:\/\/blogs.lincoln.ac.nz\/gis\/wp-content\/uploads\/sites\/3\/2013\/03\/ChristchurchPopulations-768x463.jpg 768w\" sizes=\"auto, (max-width: 1429px) 100vw, 1429px\" \/><\/a><\/p>\n<p>I&#8217;ve covered a lot in this post &#8211; but one important thing I&#8217;d like to highlight is how it&#8217;s possible to add spreadsheet data to your map. \u00a0The most important element of doing this is having a common attribute that allows you to link together the features on the map with the records in your spreadsheet. \u00a0Very handy, that.<\/p>\n<p>If you&#8217;ve got explicit location data in your spreadsheet (e.g. northings and eastings or Lat\/Long from GPS) then it&#8217;s a different process to map the points &#8211; something I can cover in another post.<\/p>\n<p>Also note that the 2006 census data are freely available from the <a href=\"http:\/\/www.stats.govt.nz\/Census\/2006CensusHomePage.aspx\" target=\"_blank\" rel=\"noopener\">StatsNZ<\/a> website. \u00a0We have all the spreadsheets and spatial layers on the data server in J:DataCensusData2006. \u00a0(Click <a title=\"How can I get some data?\" href=\"http:\/\/blogs.lincoln.ac.nz\/gis\/how-can-i-get-some-data\/\" target=\"_blank\" rel=\"noopener\" data-wplink-edit=\"true\">here<\/a> if you need to know how to connect to the J: drive.)<\/p>\n<p>Crile<\/p>\n","protected":false},"excerpt":{"rendered":"<p>In this post I&#8217;ll take about how we can make the most of the recent (and previous) census data and how to add spreadsheet data to a map. So did you fill in your census form on Tuesday night? \u00a0In the course of filling in the forms, you no doubt entered a lot of personal [&hellip;]<\/p>\n","protected":false},"author":3,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[4,5],"tags":[],"class_list":["post-44","post","type-post","status-publish","format-standard","hentry","category-common-how-to-questions","category-interesting-problems"],"_links":{"self":[{"href":"https:\/\/blogs.lincoln.ac.nz\/gis\/wp-json\/wp\/v2\/posts\/44","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blogs.lincoln.ac.nz\/gis\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blogs.lincoln.ac.nz\/gis\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blogs.lincoln.ac.nz\/gis\/wp-json\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"https:\/\/blogs.lincoln.ac.nz\/gis\/wp-json\/wp\/v2\/comments?post=44"}],"version-history":[{"count":2,"href":"https:\/\/blogs.lincoln.ac.nz\/gis\/wp-json\/wp\/v2\/posts\/44\/revisions"}],"predecessor-version":[{"id":4169,"href":"https:\/\/blogs.lincoln.ac.nz\/gis\/wp-json\/wp\/v2\/posts\/44\/revisions\/4169"}],"wp:attachment":[{"href":"https:\/\/blogs.lincoln.ac.nz\/gis\/wp-json\/wp\/v2\/media?parent=44"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blogs.lincoln.ac.nz\/gis\/wp-json\/wp\/v2\/categories?post=44"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blogs.lincoln.ac.nz\/gis\/wp-json\/wp\/v2\/tags?post=44"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}