{"id":2922,"date":"2021-04-01T20:42:53","date_gmt":"2021-04-01T07:42:53","guid":{"rendered":"http:\/\/blogs.lincoln.ac.nz\/gis\/?p=2922"},"modified":"2023-05-07T03:07:23","modified_gmt":"2023-05-07T03:07:23","slug":"deprived-data","status":"publish","type":"post","link":"https:\/\/blogs.lincoln.ac.nz\/gis\/deprived-data\/","title":{"rendered":"Deprived Data"},"content":{"rendered":"<p><em>Some quick data amalgamation tasks are tackled with spatial joins, Near and some table joins.<\/em><\/p>\n<p>Over the years we&#8217;ve spent time talking about the smoking reduction research I&#8217;ve been involved with. (<em>Ed. Who&#8217;s this we, <a href=\"https:\/\/www.youtube.com\/watch?v=56seLV0boUc\" target=\"_blank\" rel=\"noopener noreferrer\">kemosabe<\/a>?<\/em>)\u00a0 It&#8217;s had me doing <a href=\"http:\/\/blogs.lincoln.ac.nz\/gis\/the-spatial-smoking-gun-part-1\/\">geocoding<\/a>\u00a0(and <a href=\"http:\/\/blogs.lincoln.ac.nz\/gis\/another-point-on-the-map-part-3\/\" target=\"_blank\" rel=\"noopener noreferrer\">this<\/a>),\u00a0<a href=\"http:\/\/blogs.lincoln.ac.nz\/gis\/a-smokin-script\/\">Network Analysis<\/a>, a lot of <a href=\"http:\/\/blogs.lincoln.ac.nz\/gis\/deleting-smokers-part-3-progress\/\">Python scripting<\/a> and lots of little data amalgamation jobs here and there.\u00a0 As we look to finish up some recent work, I found I needed to add some data from a range of sources to my existing database and thought it might be useful to cover some of that here.\u00a0 Along the way, we get to see some of the more useful and fundamental vector spatial analysis tools.<\/p>\n<p>First off, I&#8217;ve got a layer of points containing the location and attributes of 5,131 tobacco retailers across New Zealand circa 2018.\u00a0 Regular readers (<em>Ed. Both of them.<\/em>) may recall that we&#8217;ve lately been looking at modelling the effect of reducing the number of retailers on accessibility to tobacco, and for some of the statistical analysis we need to know some of the details around levels of economic deprivation, whether a retailer is in an urban or a rural setting as well as distances to the nearest other retailer and secondary school.<\/p>\n<p>We start with my layer of retailers:<\/p>\n<p><a href=\"https:\/\/d-blogs.lincoln.ac.nz\/gis\/wp-content\/uploads\/sites\/3\/2021\/03\/AllRetailers.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-2923\" src=\"https:\/\/d-blogs.lincoln.ac.nz\/gis\/wp-content\/uploads\/sites\/3\/2021\/03\/AllRetailers.jpg\" alt=\"\" width=\"688\" height=\"786\" srcset=\"https:\/\/blogs.lincoln.ac.nz\/gis\/wp-content\/uploads\/sites\/3\/2021\/03\/AllRetailers.jpg 688w, https:\/\/blogs.lincoln.ac.nz\/gis\/wp-content\/uploads\/sites\/3\/2021\/03\/AllRetailers-263x300.jpg 263w\" sizes=\"auto, (max-width: 688px) 100vw, 688px\" \/><\/a><\/p>\n<p>In the interests of keeping things simple, I&#8217;ve stripped down my attribute table to just the basics:<\/p>\n<p><a href=\"https:\/\/d-blogs.lincoln.ac.nz\/gis\/wp-content\/uploads\/sites\/3\/2021\/03\/Table-1.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-2924\" src=\"https:\/\/d-blogs.lincoln.ac.nz\/gis\/wp-content\/uploads\/sites\/3\/2021\/03\/Table-1.jpg\" alt=\"\" width=\"238\" height=\"531\" srcset=\"https:\/\/blogs.lincoln.ac.nz\/gis\/wp-content\/uploads\/sites\/3\/2021\/03\/Table-1.jpg 238w, https:\/\/blogs.lincoln.ac.nz\/gis\/wp-content\/uploads\/sites\/3\/2021\/03\/Table-1-134x300.jpg 134w\" sizes=\"auto, (max-width: 238px) 100vw, 238px\" \/><\/a><\/p>\n<p>UniqueID2018 can be used to link each feature to the full dataset if needed.<\/p>\n<p>Data-wise, I can calculate the nearest distance to other retailers using a tool, so I&#8217;ve got what I need for that.\u00a0 For the level of economic deprivation, I&#8217;m going to need to extra data.\u00a0 Otago Uni is the source for the <a href=\"https:\/\/www.otago.ac.nz\/wellington\/departments\/publichealth\/research\/hirp\/otago020194.html\" target=\"_blank\" rel=\"noopener noreferrer\">New Zealand Deprivation Index<\/a>\u00a0(DPI)\u00a0so that&#8217;s my first stop.\u00a0 We&#8217;re focused on 2018 data (or thereabouts) and here&#8217;s what&#8217;s available from their website:<\/p>\n<p><a href=\"https:\/\/d-blogs.lincoln.ac.nz\/gis\/wp-content\/uploads\/sites\/3\/2021\/03\/DPIData.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-2925\" src=\"https:\/\/d-blogs.lincoln.ac.nz\/gis\/wp-content\/uploads\/sites\/3\/2021\/03\/DPIData.jpg\" alt=\"\" width=\"677\" height=\"567\" srcset=\"https:\/\/blogs.lincoln.ac.nz\/gis\/wp-content\/uploads\/sites\/3\/2021\/03\/DPIData.jpg 677w, https:\/\/blogs.lincoln.ac.nz\/gis\/wp-content\/uploads\/sites\/3\/2021\/03\/DPIData-300x251.jpg 300w\" sizes=\"auto, (max-width: 677px) 100vw, 677px\" \/><\/a><\/p>\n<p>Lots to choose from but I don&#8217;t see anything in spatial format though I do see plenty of Excel and Text files.\u00a0 On close inspection there are different versions to consider &#8211; I could look at &#8220;Statistical Area 1&#8221; data or &#8220;Meshblock&#8221; data or &#8220;Statistical Area 2&#8221; data.\u00a0 What the heck&#8217;s all that about?\u00a0 With a bit of digging, Otago links their DPI to the regular censuses, which are themselves linked to areas of differing sizes.\u00a0 Meshblocks are what used be the finest scale of data from the census that could be released publicly.\u00a0 Since the 2013 census, Stats New Zealand has been promoting the use of &#8220;Statistical Areas&#8221; for mapping census data.\u00a0 SA1 is the finest resolution scale aiming to have between 100 and 200 residents and no more than 500.\u00a0 SA2 aims for 1,000 &#8211; 4,000 residents and are larger in size than SA1 areas.\u00a0 \u00a0Compared to previous censuses, SA1 is roughly the meshblock scale while SA2 is more like census area units.\u00a0 These are nested areas meaning that the two different scales share the same boundaries where they are close.<\/p>\n<p>Anyway, the decision was made that we wanted to know the DPI and urban\/rural values at the SA1 level but also needed to know which SA2 area each retailer was in, so going back to the data above, I downloaded the NZDep2018 SA1 Excel spreadsheet- here&#8217;s what it looks like:<\/p>\n<p><a href=\"https:\/\/d-blogs.lincoln.ac.nz\/gis\/wp-content\/uploads\/sites\/3\/2021\/03\/SA1DPI.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-2926\" src=\"https:\/\/d-blogs.lincoln.ac.nz\/gis\/wp-content\/uploads\/sites\/3\/2021\/03\/SA1DPI.jpg\" alt=\"\" width=\"833\" height=\"427\" srcset=\"https:\/\/blogs.lincoln.ac.nz\/gis\/wp-content\/uploads\/sites\/3\/2021\/03\/SA1DPI.jpg 833w, https:\/\/blogs.lincoln.ac.nz\/gis\/wp-content\/uploads\/sites\/3\/2021\/03\/SA1DPI-300x154.jpg 300w, https:\/\/blogs.lincoln.ac.nz\/gis\/wp-content\/uploads\/sites\/3\/2021\/03\/SA1DPI-768x394.jpg 768w\" sizes=\"auto, (max-width: 833px) 100vw, 833px\" \/><\/a><\/p>\n<p>Decoding: in the spreadsheet there are 29,889 rows (SA1 areas).\u00a0 Each SA1 area has a numerical code to uniquely identify it (that will be more important later).\u00a0 The NZDep2018 column has the deprivation index value, which ranges from 1 (least deprived) to 10 (most deprived).\u00a0 The blanks are for SA1s that have no one usually resident in them.\u00a0 NZDep2018_Score is the raw value Otago used to define the DPI index value and URPopnSA1_2018 is the usually resident population for that SA1.\u00a0 For continuity, information on the SA2 area that each SA1 is nested within is provided as a code and a name.<\/p>\n<p>So, having this as a spreadsheet is handy, but what do I do with it spatially?\u00a0 Very happily, all those SA1 areas have been mapped and are freely available from <a href=\"https:\/\/datafinder.stats.govt.nz\/layer\/92211-statistical-area-1-2018-clipped-generalised\/\" target=\"_blank\" rel=\"noopener noreferrer\">Stats NZ<\/a>:<\/p>\n<p><a href=\"https:\/\/d-blogs.lincoln.ac.nz\/gis\/wp-content\/uploads\/sites\/3\/2021\/04\/SA1.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-2945\" src=\"https:\/\/d-blogs.lincoln.ac.nz\/gis\/wp-content\/uploads\/sites\/3\/2021\/04\/SA1.jpg\" alt=\"\" width=\"1916\" height=\"971\" srcset=\"https:\/\/blogs.lincoln.ac.nz\/gis\/wp-content\/uploads\/sites\/3\/2021\/04\/SA1.jpg 1916w, https:\/\/blogs.lincoln.ac.nz\/gis\/wp-content\/uploads\/sites\/3\/2021\/04\/SA1-300x152.jpg 300w, https:\/\/blogs.lincoln.ac.nz\/gis\/wp-content\/uploads\/sites\/3\/2021\/04\/SA1-1024x519.jpg 1024w, https:\/\/blogs.lincoln.ac.nz\/gis\/wp-content\/uploads\/sites\/3\/2021\/04\/SA1-768x389.jpg 768w, https:\/\/blogs.lincoln.ac.nz\/gis\/wp-content\/uploads\/sites\/3\/2021\/04\/SA1-1536x778.jpg 1536w\" sizes=\"auto, (max-width: 1916px) 100vw, 1916px\" \/><\/a><\/p>\n<p>This layer is downloadable as a shapefile or in a geodatabase so after a bit of downloading and unzipping, this layer goes on my map:<\/p>\n<p><a href=\"https:\/\/d-blogs.lincoln.ac.nz\/gis\/wp-content\/uploads\/sites\/3\/2021\/04\/SA1OnMap.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-2931\" src=\"https:\/\/d-blogs.lincoln.ac.nz\/gis\/wp-content\/uploads\/sites\/3\/2021\/04\/SA1OnMap.jpg\" alt=\"\" width=\"1596\" height=\"877\" srcset=\"https:\/\/blogs.lincoln.ac.nz\/gis\/wp-content\/uploads\/sites\/3\/2021\/04\/SA1OnMap.jpg 1596w, https:\/\/blogs.lincoln.ac.nz\/gis\/wp-content\/uploads\/sites\/3\/2021\/04\/SA1OnMap-300x165.jpg 300w, https:\/\/blogs.lincoln.ac.nz\/gis\/wp-content\/uploads\/sites\/3\/2021\/04\/SA1OnMap-1024x563.jpg 1024w, https:\/\/blogs.lincoln.ac.nz\/gis\/wp-content\/uploads\/sites\/3\/2021\/04\/SA1OnMap-768x422.jpg 768w, https:\/\/blogs.lincoln.ac.nz\/gis\/wp-content\/uploads\/sites\/3\/2021\/04\/SA1OnMap-1536x844.jpg 1536w\" sizes=\"auto, (max-width: 1596px) 100vw, 1596px\" \/><\/a><\/p>\n<p>Getting there &#8211; but while I&#8217;ve got the SA1s on the map, the DPI data is still sitting in the Excel spreadsheet, so I need a way to link them.\u00a0 <a href=\"http:\/\/blogs.lincoln.ac.nz\/gis\/a-humble-table-join-saves-the-day\/\" target=\"_blank\" rel=\"noopener noreferrer\">Table Joins<\/a> to the rescue!\u00a0 Notice anything common between the SA1 attribute table and the DPI spreadsheet?\u00a0 They both contain the SA1 code though are called different things.\u00a0 Using the values, I can join the data in the spreadsheet to the spatial layer and get the benefit of both. I do this by adding the spreadsheet to the map (not essentially, actually) and then right-clicking on the spatial layer and looking for Joins and Relates &gt; Add Join and setting up the link:<\/p>\n<p><a href=\"https:\/\/d-blogs.lincoln.ac.nz\/gis\/wp-content\/uploads\/sites\/3\/2021\/04\/Join2.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-2932\" src=\"https:\/\/d-blogs.lincoln.ac.nz\/gis\/wp-content\/uploads\/sites\/3\/2021\/04\/Join2.jpg\" alt=\"\" width=\"1599\" height=\"881\" srcset=\"https:\/\/blogs.lincoln.ac.nz\/gis\/wp-content\/uploads\/sites\/3\/2021\/04\/Join2.jpg 1599w, https:\/\/blogs.lincoln.ac.nz\/gis\/wp-content\/uploads\/sites\/3\/2021\/04\/Join2-300x165.jpg 300w, https:\/\/blogs.lincoln.ac.nz\/gis\/wp-content\/uploads\/sites\/3\/2021\/04\/Join2-1024x564.jpg 1024w, https:\/\/blogs.lincoln.ac.nz\/gis\/wp-content\/uploads\/sites\/3\/2021\/04\/Join2-768x423.jpg 768w, https:\/\/blogs.lincoln.ac.nz\/gis\/wp-content\/uploads\/sites\/3\/2021\/04\/Join2-1536x846.jpg 1536w\" sizes=\"auto, (max-width: 1599px) 100vw, 1599px\" \/><\/a><\/p>\n<p>When OK is clicked, the spreadsheet rows are joined to their corresponding SA1 record:<\/p>\n<p><a href=\"https:\/\/d-blogs.lincoln.ac.nz\/gis\/wp-content\/uploads\/sites\/3\/2021\/04\/DPIAtt.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-2933\" src=\"https:\/\/d-blogs.lincoln.ac.nz\/gis\/wp-content\/uploads\/sites\/3\/2021\/04\/DPIAtt.jpg\" alt=\"\" width=\"1267\" height=\"264\" srcset=\"https:\/\/blogs.lincoln.ac.nz\/gis\/wp-content\/uploads\/sites\/3\/2021\/04\/DPIAtt.jpg 1267w, https:\/\/blogs.lincoln.ac.nz\/gis\/wp-content\/uploads\/sites\/3\/2021\/04\/DPIAtt-300x63.jpg 300w, https:\/\/blogs.lincoln.ac.nz\/gis\/wp-content\/uploads\/sites\/3\/2021\/04\/DPIAtt-1024x213.jpg 1024w, https:\/\/blogs.lincoln.ac.nz\/gis\/wp-content\/uploads\/sites\/3\/2021\/04\/DPIAtt-768x160.jpg 768w\" sizes=\"auto, (max-width: 1267px) 100vw, 1267px\" \/><\/a><\/p>\n<p>Nice &#8211; so in one fell swoop I&#8217;ve added the DPI data, the usually resident population and along for the ride came the SA2 details (which we needed anyway &#8211; happy coincidence (<em>Ed. but was it <strong>really<\/strong> a coincidence?<\/em>).\u00a0 Since table joins like this are temporary, it&#8217;s a good idea to make this permanent by exporting this layer to a new layer (right-click on layer name &gt; Data &gt; Export Features).<\/p>\n<p>Next we need some rural\/urban data.\u00a0 Happily, the good people at Stats NZ have already done the hard yards and that one, too, and the data are right there in the DataFinder, only a download away:<\/p>\n<p><a href=\"https:\/\/d-blogs.lincoln.ac.nz\/gis\/wp-content\/uploads\/sites\/3\/2021\/04\/ruralurban.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-2934\" src=\"https:\/\/d-blogs.lincoln.ac.nz\/gis\/wp-content\/uploads\/sites\/3\/2021\/04\/ruralurban.jpg\" alt=\"\" width=\"1917\" height=\"1001\" srcset=\"https:\/\/blogs.lincoln.ac.nz\/gis\/wp-content\/uploads\/sites\/3\/2021\/04\/ruralurban.jpg 1917w, https:\/\/blogs.lincoln.ac.nz\/gis\/wp-content\/uploads\/sites\/3\/2021\/04\/ruralurban-300x157.jpg 300w, https:\/\/blogs.lincoln.ac.nz\/gis\/wp-content\/uploads\/sites\/3\/2021\/04\/ruralurban-1024x535.jpg 1024w, https:\/\/blogs.lincoln.ac.nz\/gis\/wp-content\/uploads\/sites\/3\/2021\/04\/ruralurban-768x401.jpg 768w, https:\/\/blogs.lincoln.ac.nz\/gis\/wp-content\/uploads\/sites\/3\/2021\/04\/ruralurban-1536x802.jpg 1536w\" sizes=\"auto, (max-width: 1917px) 100vw, 1917px\" \/><\/a><\/p>\n<p>With these on the map, we&#8217;re just about ready to rumble.<\/p>\n<p>Next up are the distance data.\u00a0 Recall we need two distances for each retailer: distance to closest other retailer and distance to nearest secondary school.\u00a0 The <a href=\"https:\/\/pro.arcgis.com\/en\/pro-app\/latest\/tool-reference\/analysis\/near.htm\" target=\"_blank\" rel=\"noopener noreferrer\">Near <\/a>tool comes in handy for these as a way to calculate the straight-line distance between vector features.\u00a0 We&#8217;ll first do the distance to the other retailers.<\/p>\n<p>The way this tool works is that it adds two new attributes to an existing layer (unlike most tools which create a new output layer).\u00a0 Here it is setup:<\/p>\n<p><a href=\"https:\/\/d-blogs.lincoln.ac.nz\/gis\/wp-content\/uploads\/sites\/3\/2021\/04\/Near.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-2935\" src=\"https:\/\/d-blogs.lincoln.ac.nz\/gis\/wp-content\/uploads\/sites\/3\/2021\/04\/Near.jpg\" alt=\"\" width=\"328\" height=\"511\" srcset=\"https:\/\/blogs.lincoln.ac.nz\/gis\/wp-content\/uploads\/sites\/3\/2021\/04\/Near.jpg 328w, https:\/\/blogs.lincoln.ac.nz\/gis\/wp-content\/uploads\/sites\/3\/2021\/04\/Near-193x300.jpg 193w\" sizes=\"auto, (max-width: 328px) 100vw, 328px\" \/><\/a><\/p>\n<p>Notice that I&#8217;m using the same layer as the Input <em>and<\/em> the Near Features &#8211; we would normally use this tool to find the distance to some other layer, but here I&#8217;m interested in the other features in the same layer.\u00a0 The two new fields that will be added to my will be NEAR_FID that holds the object ID of the other retailer and NEAR_DIST that will be the straight-line distance to that other retailer.\u00a0 Here&#8217;s my table after I run the tool:<\/p>\n<p><a href=\"https:\/\/d-blogs.lincoln.ac.nz\/gis\/wp-content\/uploads\/sites\/3\/2021\/04\/WithDist.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-2936\" src=\"https:\/\/d-blogs.lincoln.ac.nz\/gis\/wp-content\/uploads\/sites\/3\/2021\/04\/WithDist.jpg\" alt=\"\" width=\"401\" height=\"509\" srcset=\"https:\/\/blogs.lincoln.ac.nz\/gis\/wp-content\/uploads\/sites\/3\/2021\/04\/WithDist.jpg 401w, https:\/\/blogs.lincoln.ac.nz\/gis\/wp-content\/uploads\/sites\/3\/2021\/04\/WithDist-236x300.jpg 236w\" sizes=\"auto, (max-width: 401px) 100vw, 401px\" \/><\/a><\/p>\n<p>For the school distances, I&#8217;ve got a slight problem.\u00a0 If I rerun the Near tool again with schools as the Near Features, it will simply overwrite the NEAR_FID and NEAR_DIST attributes already there but I need to have both.\u00a0 Not to worry, I&#8217;ve got another option with this kind of proximity analysis &#8211; <a href=\"https:\/\/pro.arcgis.com\/en\/pro-app\/latest\/tool-reference\/analysis\/generate-near-table.htm\" target=\"_blank\" rel=\"noopener noreferrer\">Generate Near Table<\/a>.\u00a0 This does the same thing, but the output is a standalone table rather than an attribute in my spatial layer.\u00a0 \u00a0The output looks like this:<\/p>\n<p><a href=\"https:\/\/d-blogs.lincoln.ac.nz\/gis\/wp-content\/uploads\/sites\/3\/2021\/04\/SchoolTable.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-2937\" src=\"https:\/\/d-blogs.lincoln.ac.nz\/gis\/wp-content\/uploads\/sites\/3\/2021\/04\/SchoolTable.jpg\" alt=\"\" width=\"385\" height=\"509\" srcset=\"https:\/\/blogs.lincoln.ac.nz\/gis\/wp-content\/uploads\/sites\/3\/2021\/04\/SchoolTable.jpg 385w, https:\/\/blogs.lincoln.ac.nz\/gis\/wp-content\/uploads\/sites\/3\/2021\/04\/SchoolTable-227x300.jpg 227w\" sizes=\"auto, (max-width: 385px) 100vw, 385px\" \/><\/a><\/p>\n<p>Notice anything useful here?\u00a0 The IN_FID is the ID from my retailers layer &#8211; I can use this to join this table to my spatial layer (these joins are <em>super<\/em> useful).\u00a0 To avoid any conflicts with attribute names, before I do the join I add a new attribute called School_Dist and use Calculate Field to copy the NEAR_DIST value into it.\u00a0 <a href=\"https:\/\/www.youtube.com\/watch?v=jMTT0LW0M_Y\" target=\"_blank\" rel=\"noopener noreferrer\">All right Mr DeMille,\u00a0<\/a><a href=\"https:\/\/www.youtube.com\/watch?v=jMTT0LW0M_Y\" target=\"_blank\" rel=\"noopener noreferrer\">I&#8217;m ready for my close up<\/a>.\u00a0 After the join and an export, I&#8217;ve got both distances in my retailer layer.<\/p>\n<p>Now, how do I add the DPI and urban\/rural data to the retailers?\u00a0 I&#8217;ve got all the data I need but they are spread across three layers of two different types, points and polygons.\u00a0 How do I bring them all together in my point layer of retailers?<\/p>\n<p>I certainly hope that all those ERST202 and 606 students are shouting the same thing at their screens: <a href=\"http:\/\/www.wiki.gis.com\/wiki\/index.php\/Spatial_Join\" target=\"_blank\" rel=\"noopener noreferrer\">spatial joins<\/a>, one the simplest but most powerful of vector spatial analysis tools.\u00a0 With a spatial join, the polygon attributes that a point sits within are transferred into the point&#8217;s attribute table, thus bringing everything together.\u00a0 I&#8217;ve got three options: <a href=\"https:\/\/pro.arcgis.com\/en\/pro-app\/latest\/tool-reference\/analysis\/identity.htm\" target=\"_blank\" rel=\"noopener noreferrer\">Identity<\/a>, <a href=\"https:\/\/pro.arcgis.com\/en\/pro-app\/latest\/tool-reference\/analysis\/intersect.htm\" target=\"_blank\" rel=\"noopener noreferrer\">Intersect <\/a>and <a href=\"https:\/\/pro.arcgis.com\/en\/pro-app\/latest\/tool-reference\/analysis\/union.htm\">Union<\/a>.\u00a0 Union won&#8217;t work here because it only works on polygons.\u00a0 Both Identity and Intersect will work but I&#8217;m going with Intersect because I can join both of my polygon layers to the points in one step, rather than two that would be needed with Identity.\u00a0 So here&#8217;s Intersect,\u00a0 primed and ready to go:<\/p>\n<p><a href=\"https:\/\/d-blogs.lincoln.ac.nz\/gis\/wp-content\/uploads\/sites\/3\/2021\/04\/Intersect.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-2938\" src=\"https:\/\/d-blogs.lincoln.ac.nz\/gis\/wp-content\/uploads\/sites\/3\/2021\/04\/Intersect.jpg\" alt=\"\" width=\"326\" height=\"367\" srcset=\"https:\/\/blogs.lincoln.ac.nz\/gis\/wp-content\/uploads\/sites\/3\/2021\/04\/Intersect.jpg 326w, https:\/\/blogs.lincoln.ac.nz\/gis\/wp-content\/uploads\/sites\/3\/2021\/04\/Intersect-266x300.jpg 266w\" sizes=\"auto, (max-width: 326px) 100vw, 326px\" \/><\/a><\/p>\n<p>I&#8217;m specifying that my output will be Point though it should do that automatically (given the choice it will produce an output in the simplest type, here, points).\u00a0 Et voila!\u00a0 All the data together in one point layer.<\/p>\n<p><a href=\"https:\/\/d-blogs.lincoln.ac.nz\/gis\/wp-content\/uploads\/sites\/3\/2021\/04\/AllData.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-2939\" src=\"https:\/\/d-blogs.lincoln.ac.nz\/gis\/wp-content\/uploads\/sites\/3\/2021\/04\/AllData.jpg\" alt=\"\" width=\"1269\" height=\"282\" srcset=\"https:\/\/blogs.lincoln.ac.nz\/gis\/wp-content\/uploads\/sites\/3\/2021\/04\/AllData.jpg 1269w, https:\/\/blogs.lincoln.ac.nz\/gis\/wp-content\/uploads\/sites\/3\/2021\/04\/AllData-300x67.jpg 300w, https:\/\/blogs.lincoln.ac.nz\/gis\/wp-content\/uploads\/sites\/3\/2021\/04\/AllData-1024x228.jpg 1024w, https:\/\/blogs.lincoln.ac.nz\/gis\/wp-content\/uploads\/sites\/3\/2021\/04\/AllData-768x171.jpg 768w\" sizes=\"auto, (max-width: 1269px) 100vw, 1269px\" \/><\/a><\/p>\n<p>Nice!\u00a0 (I&#8217;ve turned off some of the attributes to make it easier to see the critical ones.)\u00a0 Last job is to use the<a href=\"https:\/\/desktop.arcgis.com\/en\/arcmap\/latest\/tools\/conversion-toolbox\/table-to-excel.htm\" target=\"_blank\" rel=\"noopener noreferrer\"> Table to Excel <\/a>tool to export this to something my Otago colleagues are happy to work with:<\/p>\n<p><a href=\"https:\/\/d-blogs.lincoln.ac.nz\/gis\/wp-content\/uploads\/sites\/3\/2021\/04\/excel.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-2940\" src=\"https:\/\/d-blogs.lincoln.ac.nz\/gis\/wp-content\/uploads\/sites\/3\/2021\/04\/excel.jpg\" alt=\"\" width=\"1919\" height=\"1037\" srcset=\"https:\/\/blogs.lincoln.ac.nz\/gis\/wp-content\/uploads\/sites\/3\/2021\/04\/excel.jpg 1919w, https:\/\/blogs.lincoln.ac.nz\/gis\/wp-content\/uploads\/sites\/3\/2021\/04\/excel-300x162.jpg 300w, https:\/\/blogs.lincoln.ac.nz\/gis\/wp-content\/uploads\/sites\/3\/2021\/04\/excel-1024x553.jpg 1024w, https:\/\/blogs.lincoln.ac.nz\/gis\/wp-content\/uploads\/sites\/3\/2021\/04\/excel-768x415.jpg 768w, https:\/\/blogs.lincoln.ac.nz\/gis\/wp-content\/uploads\/sites\/3\/2021\/04\/excel-1536x830.jpg 1536w\" sizes=\"auto, (max-width: 1919px) 100vw, 1919px\" \/><\/a><\/p>\n<p>Like many GIS analyses, all I&#8217;ve got to show for my efforts is a spreadsheet, but hopefully in this post you&#8217;ve gotten to see some of the blood and guts that goes into outputs like this.\u00a0 I thought it might be worthwhile to go through this because there was a nice variety of (vector) tools needed to get what we needed: proximity analysis with Near and Generate Near Table, table joins, and spatial joins.\u00a0 All up, with downloading data from Stats and the running of tools, this might have taken me about, oh, maybe and hour and a half?\u00a0 There was a bit of thought that went into sequencing and matching the right data for the job, but it gives my colleagues something to work on and I can now sit back and relax&#8230;but not for long.\u00a0 With GIS you&#8217;re never idle for long.\u00a0 Really must get on to finishing that darned <a href=\"http:\/\/blogs.lincoln.ac.nz\/gis\/deleting-smokers-part-3-progress\/\" target=\"_blank\" rel=\"noopener noreferrer\">Python script<\/a>&#8230;<\/p>\n<p>C<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Some quick data amalgamation tasks are tackled with spatial joins, Near and some table joins. Over the years we&#8217;ve spent time talking about the smoking reduction research I&#8217;ve been involved with. (Ed. Who&#8217;s this we, kemosabe?)\u00a0 It&#8217;s had me doing geocoding\u00a0(and this),\u00a0Network Analysis, a lot of Python scripting and lots of little data amalgamation jobs [&hellip;]<\/p>\n","protected":false},"author":3,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-2922","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/blogs.lincoln.ac.nz\/gis\/wp-json\/wp\/v2\/posts\/2922","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=2922"}],"version-history":[{"count":1,"href":"https:\/\/blogs.lincoln.ac.nz\/gis\/wp-json\/wp\/v2\/posts\/2922\/revisions"}],"predecessor-version":[{"id":4087,"href":"https:\/\/blogs.lincoln.ac.nz\/gis\/wp-json\/wp\/v2\/posts\/2922\/revisions\/4087"}],"wp:attachment":[{"href":"https:\/\/blogs.lincoln.ac.nz\/gis\/wp-json\/wp\/v2\/media?parent=2922"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blogs.lincoln.ac.nz\/gis\/wp-json\/wp\/v2\/categories?post=2922"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blogs.lincoln.ac.nz\/gis\/wp-json\/wp\/v2\/tags?post=2922"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}