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'm trying to rotate a box around its southwest corner using PostGIS. However, I am not getting the expected results when doing the rotation. I'm using SRID 3785.

The image below shows what distortion I'm talking about.


Basically, the original is a square, but the same polygon rotated 90 degrees is distorted. Rotated by 180 is back to normal, and rotate by 270 is distorted the same way.

They should all be squares. What's going on?

share|improve this question
Can you share the SQL statement you called ST_rotate with? – L_Holcombe Dec 2 '12 at 7:08
It is something along the lines of SELECT ST_Rotate(ST_MakeBox2D(<p1>, <p2>), <rads>, <p1>) where p1, p2, and rads are some variables. – zsalzbank Dec 2 '12 at 7:14
up vote 5 down vote accepted

Looks like this is a Mercator problem. Although your bounding box looks like a square, the lengths of the sides are actually unequal. In the spherical Mercator projection, which is cylindrical, scale is maintained longitudinally, but increases latitudinally. For example, at 30 degrees latitude, a degree of latitude is nearly 69 miles, while a degree of longitude is only like 60 miles. So the height of your square is actually less than the width. When your square is rotated 90deg, the former width is now the height, and it has to be stretched to maintain distance. And the former height is now the width, and it has to be contracted to maintain distance. Rotating again to 180deg stretches and contracts in reverse, returning to the original shape.

If you want the dimensions of the rotated box to be predictable, I suggest working in an equidistant projection, like 3786, and then switching back to 3785 later.

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.