Axis Order Confusion
Be careful when talking about or calculating with or passing on coordinate tuples as they can be ordered either (x,y) or (y,x)!
A lot of trouble has been caused by a deep misunderstanding between software developers and GIS users with respect to the order of the X and Y values in a coordinate tuple. Before you start to rant away that they (the respective others) are completely mad at not sticking to either convention A (x,y) or convention B (y,x) please consider this to be a fact. Then read on and find out how we deal with the problem. If you can add to the solution go hack the Wiki. Tank you.
From the perspective of a geographic software design three coordinate systems can potentially be addressed:
- Axis Order X, Y
- Signed values, increase up and right
- Computer Graphics
- Axis Order X, Y
- Unsigned values increase down and right limited to graphics size
- Geographical Coordinate Systems
- Axis Order Y, X
- Signed values increase up and right limited to -180, -90, 180, 90 (a shperoid)
All result in an ordered pair of numbers describing a position in space but there is some confusion as to the order.
Developing Software that uses Coordinates
Shoftware developers should usually try to implement interfaces for users. Many of these users do not now that the standard convention is to put X in front and Y in the back in a coordinate tuple. They have learned to use different terms to describe the same thing, namely Latitude and Longitude. And they learned to do it the other way and say Latitude, Longitude (that is: y, x). Are they crazy? No they are not, they are simply sticking to another convention.
This confusion also applies to Spherical Coordinates in mathematics which does not make things any easier but shows that we are not alone with our problems. Citing from that page:
Warning: The notation for spherical coordinates is not standard. Sometimes they are written in a different order and sometimes the letters phi and theta are interchanged. In short, be careful when using spherical coordinates. You cannot assume that when someone else uses notation that looks like the notation here it is being used the same way.
This should be our prime contribution to this issue. Help people work it out so that the result is correct.
There are several reasons why it is necessary to bother. Most have been mentioned on a very long mailing list thread at the OGC regarding the use of latlon in standards specifications (I am ignorant of whether these lists are public). If you had to pick from two reasons why to use either (x,y) or (y,x) which would you choose?
- A) Because it is a convention
- B) Because human life depends on it
So lets forget about whether it hurts anybody to read lonlat instead of latlon in a specification (option A). They will have to put up with this.
But yes, there are large user groups who are accustomed to using the wrong (both from mathematical and computer technological view point) axis order of Y, X. Every user in a nautical, aerial and ground navigation environment is used to a different notation. Basically anybody working with machine interfaces to spatially enabled technology is in danger of commiting an axis order confusion. If you look at the hardware tools they usually very clearly depict the axis order through labels. If you take a GPS or a radar it always says Latitude and Longitude printed on them.
On the technical side people developing software naturally fall back to the X,Y axis order because 99.9% of all IT does it his way. People using other devices often naturally fall back to the (y, x) notation.
It will not help to define new standards or deprecate old ones or fix a new definition as the involved standard are already given. The only possible cure for this disease is to make people know about it. No matter how far the tuple is pushed in either the software or the user direction at one point it will collide with reality, either in computer graphics (which additionally have their origin in the upper left) or on a ship which does navigate first by latitude and then by longitude.
Whatever you do be careful that you do it the "right" way and make your choice clearly visible.