Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am currently working with climate data projected in a rotated lat/lon grid and came across this excellent 'cookbook' by mkadunc on how to manually transform rotated lat/lon to regular lat/lon:

I’ve implemented the solution for transforming a rotated grid to a regular grid; however, I’m also interested in doing the opposite. My first thought was to just change the operational sign of ϑ and φ, so that the transformation will go ‘the other way around the clock’, but this doesn’t seem to work leaving me a bit stuck here. I’ve spend some hours now trying to read up on my trigonometry, but still haven’t been able to ‘reverse’ the function.

share|improve this question
No trig is needed: just invert the matrix for the (x',y',z') -> (x,y,z) transformation. – whuber Jun 24 '13 at 16:54
up vote 4 down vote accepted

Right, whuber. I finally got there myself. While mkadunc shows how to ‘undo’ a rotation, where the rotated coordinate system is first rotated around the y'-axis and then the z'-axis to match a regular coordinate system, I was interested in performing a rotation from a regular grid; thus, the regular coordinate system shall first be rotated around the z-axis and then the y-axis.

Hence, when you calculate the product of:

x   ( cos(φ), sin(φ), 0) (  cos(ϑ), 0, sin(ϑ)) (x')
y = (-sin(φ), cos(φ), 0).(  0     , 1, 0     ).(y')
z   ( 0     , 0     , 1) ( -sin(ϑ), 0, cos(ϑ)) (z')

where the first matrix (A) represent the rotation around the z-axis and the second matrix (B) represent the rotation around the y-axis, A*B becomes:

x   ( cos(ϑ)cos(φ) , -cos(ϑ)sin(φ) , -sin(ϑ)) (x')
y = ( sin(φ)       ,  cos(φ)       ,  0     ).(y')
z   ( sin(ϑ) cos(φ), -sin(ϑ) sin(φ),  cos(ϑ)) (z')

which is indeed the inverse of B*A, or (B*A)^T since it's orthogonal.

In case anyone is interested I've shared a MATLAB script on the file exchange transforming regular lat/lon to rotated lat/lon and vice versa: Rotated grid transform

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.