## The danger of geographic coordinates in geospatial analyses

It is often unwise to perform geospatial analysis with data in a geographic coordinate system (latitude and longitude) as this can introduce substantial bias into an analysis. Most analytical functions that are based on distances will assume a Cartesian coordinate system, not a spherical coordinate system. Treating a spherical coordinate system (in which the x and y coordinates are measure angular deviation from a plane) as though they were Cartesian coordinates (in which the x and y coordinates are distances from the origin parallel to the x and y axes respectively) is the source of the problem.

The trouble with geographic coordinates is that one unit of measure in the x axis does not equal one unit in the y axis, and this inequality become more pronounced the further from the equator the location is. At the equator one unit of measure in the x and y axes is similar, but towards either of the poles one unit of latitude represents a much longer distance than one unit of longitude.

For a simple demonstration of this consider a sphere of radius 6,371 km (the approximate radius of the earth) and circumference 40,030 km (2*pi*r). One degree of latitude is always 40030/360 = 111.2 km. On the equator of this hypothetical sphere one degree of longitude is also 111.2 km. But at 45 degrees of latitude one degree of longitude (dx) is given by the R formula:

calc.dx <- function(y, r){ return(2*pi*sqrt(r^2 - (r*sin(y))^2)/360) }

where r is the radius of the sphere and y is the latitude in radians. The distance units of dx are whatever the units of the radius are. So at 45 degree latitude (pi/4 radians), dx = 78.6 km.

We can visualise how the distance that one unit of longitude represents changes as a function of latitude as follows:

# a vector of latitudes of 0-90 degrees in 1 degree increments (as radians) y <- seq(0, pi/2, length.out=90) # calculate dx based on this vector dx <- calc.dx(y, 6371) # plot the results (converting radians back to degrees for clarity) plot(180*y/pi, dx, type="l", col="blue", xlab="latitude (degrees)", ylab="distance (km) of 1 degree of latitude")

There are some software packages that are designed to hande geographic coordinates correctly, but many do not. The safest approach is to use a projected coordinate system (Cartesian coordinates) for your analysis.

A few examples of geospatial analyses that are likely to be affected by this problem:

- area calculations
- distance-based raster calculations (e.g. distance to feature)
- least cost path analyses
- kernel density analysis
- movement modelling
- density calculations (e.g. density of lines in polygons)
- proximty analyses (e.g. find all features within a given distance)