## Why EPSG:4326 is usually the wrong “projection”

…or why spherical coordinate systems are not flat!

One of the most common ways the round world is displayed on a map is using the simplest projection we have:

x = longitude y = latitude

The name of this projection is “Plate Carree”, and is widely used because it is so simple. However we often seem to forget that we are talking about a projection. Therefore the spatial reference for this projection is very often (mis)referenced as a spherical coordinate system like the following for EPSG:4326:

GEOGCS["GCS_WGS_1984",DATUM["D_WGS_1984",SPHEROID["WGS_1984",6378137,298.257223563]],

PRIMEM["Greenwich",0],UNIT["Degree",0.017453292519943295]]

GEOGCS denotes “Geographical Coordinate System”, meaning a spherical coordinate system using angles for latitude and longitudes, not X’s and Y’s. However, the moment we project this map onto a flat screen or piece of paper, we projected the coordinate system (using the simple formula above), so how can the spatial reference of our map be the above one?

I found that in ArcMap you can manually define a projected coordinate system that renders the same map, but correctly identifies the coordinate system as being projected. Below is the Well-known-text representation of this projection string (note how PROJCS denotes projected coordinate system, and how EPSG:4326 is defined inside it):

PROJCS["World_Plate_Carree_Degrees",*GEOGCS["GCS_WGS_1984",
DATUM["D_WGS_1984",SPHEROID["WGS_1984",6378137,298.257223563]],
PRIMEM["Greenwich",0],UNIT["Degree",0.017453292519943295]*],

PROJECTION["Plate_Carree"],PARAMETER["False_Easting",0],

PARAMETER["False_Northing",0],PARAMETER["Central_Meridian",0],

UNIT["Degree",111319.49079327357264771338267056]]

As far as I know we don’t have a spatial reference ID for the above (EPSG:54001 comes close but uses a different linear unit), so we often incorrectly start using EPSG:4326 to describe a projection. This has been done for so long, that this is now common (mal)practice. Even OGC’s WMS specification allows you request flat maps in a spherical coordinate system, even though this doesn’t really make any sense.

So why is this a problem? Well until recently it hasn’t really been a problem, mostly because it was rare that the spherical coordinate were correctly handled, and most applications assumed that the world was flat. However, Microsoft SQL Server 2008 can correctly handle spherical coordinates, and suddenly this becomes a major problem.

Below is a query on all the counties that follow the red line defined by two points. The blue polygons is the result returned. The map claims that its spatial reference is EPSG:4326. Because of the curvature Earth, a straight line between the two endpoints looks like a curve on the projected map, so the results returned seems like they don’t match with the line, but they are in fact the counties on the line between the two endpoints if you think in a spherical coordinate system.

The real problem here is not that the line is not really a curve (I drew the line like that because I want the features along that latitude). The problem is that the line didn’t know that it was projected, because the map it was displayed on was incorrectly set to EPSG:4326. However had the application known that this was not a spherical coordinate system, but a Plate Carree projection, it would have known that when converting from the flat coordinate system to the spherical coordinate system, it should ensure that my line follows the latitude. But because the input line already claims to be in spherical units, the application can not know that it needs to do anything to it (aside the fact that the application of course knows that this came from a flat screen map, but the business logic is of course separate from the UI).

This brings me to another even worse issue: I’d like to make the claim that almost ** all of the data you have that claims to be in EPSG:4326 has never been EPSG:4326** ! (point data excluded).

Example: Most of the northern US border roughly follows the 49’th latitude. Let’s for sake of argument define the whole northern border as two points, from coast to coast, 49 degrees north. If I then think that my data is in EPSG:4326 (or any other geographic coordinate system), the border will NOT be following the 49th latitude, but go along a great circle that cuts into Canada.

So let us thank Microsoft for creating a database that handles spherical coordinates correctly, and for giving us major headaches when trying to handle these things correctly in a clean clear way :-). Of course there wouldn’t be any headaches if we never mixed spherical and flat coordinate systems in the first place.

## Vish

3/29/2009 12:14:26 PM |Hi Morten,

So, isn't the problem here that the drawing tools (graphics layer on the browser) lets you draw bad features (straight looking lines that are not geographically straight).

Thank You,

Vish

## Morten

3/29/2009 12:48:59 PM |The problem is not the tool. It was made to work on a flat screen drawing lines that are straight in the projection. Since you are drawing on a flat screen, you are drawing in a projection. A geographic coordinate system cannot be drawn on a screen without projecting it first. That's the whole point of the post.

We would need 2.5D rendering like Google Earth/Virtual Earth 3D/ArcGIS Explorer to work in geographic coordinates (technically these engines are also projecting to 2D on the fly - rotating Earth is equivalent to changing the projection parameters, but in this case the graphics card usually takes care of that for us at the the last step).

## Vish

3/30/2009 2:11:49 PM |Hi Morten,

But don't you think that when the user draws a line from the eastern US to the Western US along the same latitude, the line should be displayed as a curve on the map instead of a line? Your drawing is not a flat surface anymore... Because, the map below is curved (well ... you know what is mean). But the client-side layer is not upto projecting it on the fly like the other apps you mentioned.

Vish

## Morten

3/30/2009 4:23:46 PM |No, because the the tool is working on top of a projection. I am in deed drawing on a flat surface. Unless you have some really wacky monitor, I bet that your monitor is flat.