Degrees of Distance
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’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 HydroWASTE while the river network came from HydroRIVERS (both available on the J: drive). I’d love to show you the whole dataset but at the global scale there are too many points to see any detail, so here’s a zoomed in version from our neck of the global woods:

(I used Graduated Symbols to symbolise HydroRIVERS using the stream order attribute.)
As noted above, we’re interested in using the distance from each plant to the nearest river reach so the Near 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 – here’s how I set up the tool:

and here’s the resulting table:

Wait – what’s going on here? Look at those NEAR_DIST values – none of them is greater than 1 which can’t be the case. Looking more closely at one of those records, we can see that they’re not nearly as close as the values say they are:

The table tells me that the Methven plant is about 6 mm away from the river, which simply can’t be right.
Interpreting that value as 6 mm would be correct IF the distance units were in metres. But they’re not, and that’s the problem here. If we look more closely at the data, we can see that the layer’s coordinate system is WGS 1984:

WGS84 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 angle between the points and the river features.
So what next? I think I’ve got a few options:
- 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
- Rerun the tool with the Distance Unit set to meters:
, or
- Use the Project tool to convert the HydroWASTE and HydroRIVERS layers to a projected coordinate system (making it flat and cartesian, with distance units in metres)
Any of these will work; I would suggest using the last one as its best practice. Next I’d need to think about which projected coordinate system to use. Since these particular data are from NZ, I’d use New Zealand Transverse Mercator if these were my only points. But this layer has a global extent so I should go with something like WGS 1984 Web Mercator (auxiliary sphere), which is in metres and works everywhere. The new layer will look exactly the same and will map in exactly the same place; it’s just that under the bonnet it’s in a different coordinate system. Running Near again gives us:

Now that’s more like it. If I’m feeling persnickety (whatever that means), I can double-check this using the Measure tool:

Now we can get back to some proper analysis.
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.
C