[postgis-users] How to Rotate a polygon.

Bruce Rindahl rindahl at lrcwe.com
Fri Feb 23 07:59:57 PST 2007


Try

SELECT translate(
rotate(
translate(the_geom,-x(centroid(the_geom)),-y(centroid(the_geom)))
,radians(45))
,x(centroid(the_geom)),y(centroid(the_geom)))

The third line translates the center of the polygon to 0,0.
The rotate function then rotates that polygon 45 degrees (lines 2,3,4)
Finally the final translate (lines 1 and 5) translates the polygon back to
the original center.  The same trick can be used if you want to rotate
around a corner of the polygon.

Bruce Rindahl



-----Original Message-----
From: postgis-users-bounces at postgis.refractions.net
[mailto:postgis-users-bounces at postgis.refractions.net] On Behalf Of Maciej
Skorczewski
Sent: Friday, February 23, 2007 7:44 AM
To: PostGIS Users Discussion
Subject: Re: [postgis-users] How to Rotate a polygon.

hi Shoaib Burq!

ok but how to rotete polygon  who sould be stay in center point of this 
polygon before rotete

take a look on example:
http://img412.imageshack.us/img412/262/rotate2ri0.png

it is posible? how can i make it?

thx for.



_______________________________________________
postgis-users mailing list
postgis-users at postgis.refractions.net
http://postgis.refractions.net/mailman/listinfo/postgis-users






More information about the postgis-users mailing list