## Saturday, November 3, 2007

### Axis Order Confusion: Software, Geodesy & Transformations Axis Order Confusion

Not simply X, Y, Z or N, E, S, W, but how we interpret them and use them in software, geodesy and navigation - it varies and has led to confusion among many people. This is an overview of the systems, the problem and points out things to take note of.

Over time, since the early days of mathematics, and then moving into software development, GIS and internet mapping, axis play an important role, whether it be in datum transformation or even displaying a map.

Is it X,Y,Z or Z,Y,X?

As we know in mathematics, a coordinate system is a system for assigning n-tuple of numbers or scalars to each point in n-dimensional space.

We are familiar with the following coordinate sytems involved in GIS/Mapping and Geodesy:

• Cartesian coordinate system, which may be called "rectangular", where for 3D space, it uses three numbers representing some distance

• Polar coordinate systems

• Curvilinear coordinates, which are based on an intersection of curves

Delving further into Polar coordinate systems, we see the following subtypes:

• Circular coordinate systems, which is represented by a point in a plane, by an angle, and a distance from the origin

• Cylinderical coordinate systems which require a point in space, a distance from an origin an a height

• Spherical coordinate system, which is represented by two angles and a distance from an origin

In mapping and geodesy, we deal quite often with Spherical coordinate systems and often refer to them as Geographic Coordinate Systems.

Ordered Pairs & Coordinate Systems

In GIS software and mapping software, we have three different perspectives for an Ordered Pair (2-tuple). They are in computer science, mathematics and of course Geographical Coordinate Systems.

Let's take a quick look at how these distinct perspectives see the their world:

In computer science and computer graphics, the axis order is (X,Y), where unsigned values increase to the bottom and to the right.

Mathematics sees this world differently for the same axis order (X,Y), where we have signed values increase to the right and upwards.

In the world, where we are most involved, Geographical Coordinate Systems, the axis order varies, sometimes being (X,Y) or (Y,X). The signed values increase upwards and to the right, based on a spheroid, hence we have -180, -90, 180, and 90.

Rotation Confusion as Well - Which Sign is positive?

There are 2 different conventions in use in the survey and mapping industry for defining rotations.

This too has led to considerable confusion in the GIS and mapping world.

Both are valid when used properly.

The two conventions can be referred to as:

1) Position Vector rotation (Commonly referred to as the Busra-Wolfe)

2) Coordinate Frame rotation

This essentially comes down to the left-handed vs. right-handed rotations (see image above) for the various transforms.

But what does this mean with left vs. right? Well, this is one way of determining orientation of axes and direction of rotations.

• Thumb = Positive X
• Index up = Positive Y
• Middle out = Positive Z

Clifford's Point of View

Clifford Mugnier of LSU, whom I met when I lived in Houston, gives a good explanation and way of handling rotations and coordinate systems. His reply can be found here.

My quote follows:

"Probably the best way to document a rotation method is:

use the accepted terms "coordinate frame" and "position vector".

These terms are also used in other disciplines like kinematics (robotics).

But there are more difficulties.One datum transformation method is laid down in the ISO 19111 standard.

This is an approximated 7-parameter Helmert transformation with position vectorrotation. See also ISO/IEC 18026 - Annex B.

PROJ uses about the same method, only the scaling method differs. PROJ does a scalar multiplication, ISO a matrix multiplication.

With the commonly used parameter ranges, the differences between the scaling methods are less than microns, so not important.

As far as I know, the Bursa-Wolfe transform is an approximation to theHelmert transform. The Helmert transform has sines and cosines in therotation matrices, whereas Bursa-Wolfe (and ISO 19111) use the angles themselves (since sin(a) ~ a, sin(a)*sin(b) ~ 0, and cos(a) ~ 1 for small angles).

If you read section B.6 of ISO/IEC 18026, then you'll notice that aBursa-Wolfe transform can be done with a position vector rotation model OR with a coordinate frame rotation model.

Just what one likes the best; be sure to use the correct sign of the rotation angles.

Therefore:

Bursa-Wolfe is NOT equivalent with this or that rotation model.

A well known expert repeatedly states that the Australians use the same datum transform rotation model as the Americans.

This is NOT true!

The order of the rotations differs (XYZ vs. ZYX).

See the Australian GDATechnical Manual.

By the way, if the rotations are approximated, then the order is not important.

Again, the differences in rotation order for real life numbers are literally microscopic."

He clearly points out, and I agree, that it is "silly to refer to a datum transformation method as an American, Australian, European, whatever regional model. If you want to document the way for instance an application transforms,givethe complete formulae, not just an ill-defined name. Why not referring to the EPSG coordinate transformation method numbers? These clearly define the most used datum transformation methods and projection methods."

A simple solution to a complex problem of rotations.

The key is to document and document and be sure to specify what is being done, what axis are being used and let your users know. Do not assume, ask questions, and your life will be easier when dealing with coordinate sytems and rotations.

Or even simplier, as Clifford points out, refer to the coordinate transformation method numbers referenced in the EPSG data and data model for defined coordinate sytems.