{"id":4901,"date":"2025-07-17T00:41:21","date_gmt":"2025-07-17T00:41:21","guid":{"rendered":"https:\/\/blogs.lincoln.ac.nz\/gis\/?p=4901"},"modified":"2025-07-17T00:41:22","modified_gmt":"2025-07-17T00:41:22","slug":"degrees-of-distance","status":"publish","type":"post","link":"https:\/\/blogs.lincoln.ac.nz\/gis\/degrees-of-distance\/","title":{"rendered":"Degrees of Distance"},"content":{"rendered":"\n<p><em>When measuring distance it pays to be aware of which coordinate system your data are using.<\/em><\/p>\n\n\n\n<p>Hot off a discussion of coordinate systems and map projections in the GIS courses, I was reminded of something that threw me for a loop with some of the global scale analysis we&#8217;ve been doing lately. This one was around modelling E.coli distributions based on measured values and then extending these as predictions globally. We had a point layer of waterwater treatment plant locations and wanted to use the distance to the nearest river reach as a parameter in the model. The plant locations came from <a href=\"https:\/\/www.hydrosheds.org\/products\/hydrowaste\" target=\"_blank\" rel=\"noreferrer noopener\">HydroWASTE <\/a>while the river network came from <a href=\"https:\/\/www.hydrosheds.org\/products\/hydrorivers\" target=\"_blank\" rel=\"noreferrer noopener\">HydroRIVERS<\/a> (both available on the J: drive). I&#8217;d love to show you the whole dataset but at the global scale there are too many points to see any detail, so here&#8217;s a zoomed in version from our neck of the global woods:<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"547\" src=\"https:\/\/blogs.lincoln.ac.nz\/gis\/wp-content\/uploads\/sites\/3\/2025\/07\/Points-1024x547.jpg\" alt=\"\" class=\"wp-image-4902\" srcset=\"https:\/\/blogs.lincoln.ac.nz\/gis\/wp-content\/uploads\/sites\/3\/2025\/07\/Points-1024x547.jpg 1024w, https:\/\/blogs.lincoln.ac.nz\/gis\/wp-content\/uploads\/sites\/3\/2025\/07\/Points-300x160.jpg 300w, https:\/\/blogs.lincoln.ac.nz\/gis\/wp-content\/uploads\/sites\/3\/2025\/07\/Points-768x411.jpg 768w, https:\/\/blogs.lincoln.ac.nz\/gis\/wp-content\/uploads\/sites\/3\/2025\/07\/Points-1536x821.jpg 1536w, https:\/\/blogs.lincoln.ac.nz\/gis\/wp-content\/uploads\/sites\/3\/2025\/07\/Points.jpg 1633w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p>(I used Graduated Symbols to symbolise HydroRIVERS using the <a href=\"https:\/\/blogs.lincoln.ac.nz\/gis\/orderly-streams\/\" target=\"_blank\" rel=\"noreferrer noopener\">stream order<\/a> attribute.)<\/p>\n\n\n\n<p>As noted above, we&#8217;re interested in using the distance from each plant to the nearest river reach so the <a href=\"https:\/\/pro.arcgis.com\/en\/pro-app\/latest\/tool-reference\/analysis\/near.htm\" target=\"_blank\" rel=\"noreferrer noopener\">Near <\/a>tool is a great option here.  This will add two new attributes to the waste water plant attribute table: NEAR_FID (the identifier for the nearest river feature) and NEAR_DIST (the calculated distance).  Pretty straightforward &#8211; here&#8217;s how I set up the tool:<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"285\" height=\"638\" src=\"https:\/\/blogs.lincoln.ac.nz\/gis\/wp-content\/uploads\/sites\/3\/2025\/07\/Tool.jpg\" alt=\"\" class=\"wp-image-4906\" srcset=\"https:\/\/blogs.lincoln.ac.nz\/gis\/wp-content\/uploads\/sites\/3\/2025\/07\/Tool.jpg 285w, https:\/\/blogs.lincoln.ac.nz\/gis\/wp-content\/uploads\/sites\/3\/2025\/07\/Tool-134x300.jpg 134w\" sizes=\"auto, (max-width: 285px) 100vw, 285px\" \/><\/figure>\n\n\n\n<p>and here&#8217;s the resulting table:<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"276\" src=\"https:\/\/blogs.lincoln.ac.nz\/gis\/wp-content\/uploads\/sites\/3\/2025\/07\/Table-1024x276.jpg\" alt=\"\" class=\"wp-image-4903\" srcset=\"https:\/\/blogs.lincoln.ac.nz\/gis\/wp-content\/uploads\/sites\/3\/2025\/07\/Table-1024x276.jpg 1024w, https:\/\/blogs.lincoln.ac.nz\/gis\/wp-content\/uploads\/sites\/3\/2025\/07\/Table-300x81.jpg 300w, https:\/\/blogs.lincoln.ac.nz\/gis\/wp-content\/uploads\/sites\/3\/2025\/07\/Table-768x207.jpg 768w, https:\/\/blogs.lincoln.ac.nz\/gis\/wp-content\/uploads\/sites\/3\/2025\/07\/Table.jpg 1279w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p>Wait &#8211; what&#8217;s going on here? Look at those NEAR_DIST values &#8211; none of them is greater than 1 which can&#8217;t be the case. Looking more closely at one of those records, we can see that they&#8217;re not nearly as close as the values say they are:<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"661\" src=\"https:\/\/blogs.lincoln.ac.nz\/gis\/wp-content\/uploads\/sites\/3\/2025\/07\/Methven-1024x661.jpg\" alt=\"\" class=\"wp-image-4904\" srcset=\"https:\/\/blogs.lincoln.ac.nz\/gis\/wp-content\/uploads\/sites\/3\/2025\/07\/Methven-1024x661.jpg 1024w, https:\/\/blogs.lincoln.ac.nz\/gis\/wp-content\/uploads\/sites\/3\/2025\/07\/Methven-300x194.jpg 300w, https:\/\/blogs.lincoln.ac.nz\/gis\/wp-content\/uploads\/sites\/3\/2025\/07\/Methven-768x496.jpg 768w, https:\/\/blogs.lincoln.ac.nz\/gis\/wp-content\/uploads\/sites\/3\/2025\/07\/Methven.jpg 1265w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p>The table tells me that the Methven plant is about 6 mm away from the river, which simply can&#8217;t be right.<\/p>\n\n\n\n<p>Interpreting that value as 6 mm would be correct <strong><em>IF<\/em><\/strong> the distance units were in metres. But they&#8217;re not, and that&#8217;s the problem here. If we look more closely at the data, we can see that the layer&#8217;s coordinate system is WGS 1984:<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"968\" height=\"623\" src=\"https:\/\/blogs.lincoln.ac.nz\/gis\/wp-content\/uploads\/sites\/3\/2025\/07\/Props.jpg\" alt=\"\" class=\"wp-image-4905\" srcset=\"https:\/\/blogs.lincoln.ac.nz\/gis\/wp-content\/uploads\/sites\/3\/2025\/07\/Props.jpg 968w, https:\/\/blogs.lincoln.ac.nz\/gis\/wp-content\/uploads\/sites\/3\/2025\/07\/Props-300x193.jpg 300w, https:\/\/blogs.lincoln.ac.nz\/gis\/wp-content\/uploads\/sites\/3\/2025\/07\/Props-768x494.jpg 768w\" sizes=\"auto, (max-width: 968px) 100vw, 968px\" \/><\/figure>\n\n\n\n<p><a href=\"https:\/\/blogs.lincoln.ac.nz\/gis\/analyst-know-thy-coordinates\/\">WGS84<\/a> is the World Geodetic System (1984). This is the coordinate system that GPS system uses. The above image also shows us the units for this coordinate system: degrees. Recall that WGS84 is a Geographic Coordinate System, meaning it uses latitude and longitude to specify 3D locations on the surface of the earth. The value we see in the NEAR_DIST field is the <em>angle <\/em>between the points and the river features.<\/p>\n\n\n\n<p>So what next?  I think I&#8217;ve got a few options:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Using trigonometry and making some assumptions about the distance from each point and each river feature to the centre of the earth, I could calculate that distance, or<\/li>\n\n\n\n<li>Rerun the tool with the Distance Unit set to meters: <img loading=\"lazy\" decoding=\"async\" width=\"271\" height=\"56\" class=\"wp-image-4907\" style=\"width: 150px\" src=\"https:\/\/blogs.lincoln.ac.nz\/gis\/wp-content\/uploads\/sites\/3\/2025\/07\/meters.jpg\" alt=\"\">, or<\/li>\n\n\n\n<li>Use the <a href=\"https:\/\/pro.arcgis.com\/en\/pro-app\/latest\/tool-reference\/data-management\/project.htm\" target=\"_blank\" rel=\"noreferrer noopener\">Project <\/a>tool to convert the HydroWASTE and HydroRIVERS layers to a projected coordinate system (making it flat and cartesian, with distance units in metres)<\/li>\n<\/ul>\n\n\n\n<p>Any of these will work; I would suggest using the last one as its best practice. Next I&#8217;d need to think about which projected coordinate system to use. Since these particular data are from NZ, I&#8217;d use <a href=\"https:\/\/www.linz.govt.nz\/guidance\/geodetic-system\/coordinate-systems-used-new-zealand\/projections\/new-zealand-transverse-mercator-2000-nztm2000\" target=\"_blank\" rel=\"noreferrer noopener\">New Zealand Transverse Mercator<\/a> if these were my only points. But this layer has a global extent so I should go with something like <a href=\"https:\/\/epsg.io\/3857\" target=\"_blank\" rel=\"noreferrer noopener\">WGS 1984 Web Mercator (auxiliary sphere)<\/a>, which is in metres and works everywhere. The new layer will look exactly the same and will map in exactly the same place; it&#8217;s just that under the bonnet it&#8217;s in a <a href=\"https:\/\/blogs.lincoln.ac.nz\/gis\/how-to-be-in-two-or-more-places-at-once\/\" target=\"_blank\" rel=\"noreferrer noopener\">different coordinate system<\/a>. Running Near again gives us:<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"326\" src=\"https:\/\/blogs.lincoln.ac.nz\/gis\/wp-content\/uploads\/sites\/3\/2025\/07\/InMeters-1024x326.jpg\" alt=\"\" class=\"wp-image-4908\" srcset=\"https:\/\/blogs.lincoln.ac.nz\/gis\/wp-content\/uploads\/sites\/3\/2025\/07\/InMeters-1024x326.jpg 1024w, https:\/\/blogs.lincoln.ac.nz\/gis\/wp-content\/uploads\/sites\/3\/2025\/07\/InMeters-300x95.jpg 300w, https:\/\/blogs.lincoln.ac.nz\/gis\/wp-content\/uploads\/sites\/3\/2025\/07\/InMeters-768x244.jpg 768w, https:\/\/blogs.lincoln.ac.nz\/gis\/wp-content\/uploads\/sites\/3\/2025\/07\/InMeters.jpg 1277w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p>Now that&#8217;s more like it. If I&#8217;m feeling persnickety (whatever that means), I can double-check this using the Measure tool:<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"650\" src=\"https:\/\/blogs.lincoln.ac.nz\/gis\/wp-content\/uploads\/sites\/3\/2025\/07\/Measure1-1-1024x650.jpg\" alt=\"\" class=\"wp-image-4912\" srcset=\"https:\/\/blogs.lincoln.ac.nz\/gis\/wp-content\/uploads\/sites\/3\/2025\/07\/Measure1-1-1024x650.jpg 1024w, https:\/\/blogs.lincoln.ac.nz\/gis\/wp-content\/uploads\/sites\/3\/2025\/07\/Measure1-1-300x191.jpg 300w, https:\/\/blogs.lincoln.ac.nz\/gis\/wp-content\/uploads\/sites\/3\/2025\/07\/Measure1-1-768x488.jpg 768w, https:\/\/blogs.lincoln.ac.nz\/gis\/wp-content\/uploads\/sites\/3\/2025\/07\/Measure1-1.jpg 1280w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p>Now we can get back to some proper analysis.<\/p>\n\n\n\n<p>The upshot of this experience was to be reminded of the importance of coordinate systems and, in this case, the units they use. Underneath every thing we do in GIS, coordinate systems are the foundation. They are what make all these amazing kinds of analysis possible and the well-tuned analyst will always aim to keep on top of potential problems they can throw at us.  Like having the title of this post being an oxymoron.<\/p>\n\n\n\n<p>C<\/p>\n\n\n\n<p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>When measuring distance it pays to be aware of which coordinate system your data are using. Hot off a discussion of coordinate systems and map projections in the GIS courses, I was reminded of something that threw me for a loop with some of the global scale analysis we&#8217;ve been doing lately. This one was [&hellip;]<\/p>\n","protected":false},"author":3,"featured_media":4915,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-4901","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/blogs.lincoln.ac.nz\/gis\/wp-json\/wp\/v2\/posts\/4901","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=4901"}],"version-history":[{"count":5,"href":"https:\/\/blogs.lincoln.ac.nz\/gis\/wp-json\/wp\/v2\/posts\/4901\/revisions"}],"predecessor-version":[{"id":4916,"href":"https:\/\/blogs.lincoln.ac.nz\/gis\/wp-json\/wp\/v2\/posts\/4901\/revisions\/4916"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/blogs.lincoln.ac.nz\/gis\/wp-json\/wp\/v2\/media\/4915"}],"wp:attachment":[{"href":"https:\/\/blogs.lincoln.ac.nz\/gis\/wp-json\/wp\/v2\/media?parent=4901"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blogs.lincoln.ac.nz\/gis\/wp-json\/wp\/v2\/categories?post=4901"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blogs.lincoln.ac.nz\/gis\/wp-json\/wp\/v2\/tags?post=4901"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}