[postgis-users] How to Rotate a polygon.

Shoaib Burq shoaib at nomad-labs.com
Fri Feb 23 06:36:07 PST 2007


Hi Maciek

Have a look at RotateZ(geometry, float8). It should do the trick.
http://postgis.refractions.net/docs/ch06.html#id2939343

Assuming you have a postgis database here is an quick example usage

CREATE TABLE shapes (gid serial PRIMARY KEY,  name varchar);
SELECT AddGeometryColumn('', 'shapes', 'the_geom', -1, 'POLYGON', 2);

insert into "shapes" ("the_geom", "name") values (
	'POLYGON((0 0, 0 5, 10 5, 10 0, 0 0))', 'lying down');

select AsText(RotateZ(the_geom, 0.7854)) from shapes where name = 'lying down';

see attached image for the output

hope this helps
shoaib
--
http://nomad-labs.com

On 2/23/07, Maciej Skorczewski <maciej.skorczewski at procad.pl> wrote:
> hi all!
>
> i am new in postgis my guestion is:
>
> how to rotate  a polygon?
>
> The problem is that polygon suld be stay i start point - then i make
> rotation
>
> http://img213.imageshack.us/img213/6642/rotateiq7.jpg
>
> thx.
>
> maciek
> _______________________________________________
> postgis-users mailing list
> postgis-users at postgis.refractions.net
> http://postgis.refractions.net/mailman/listinfo/postgis-users
>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: postgis_RotateZ.png
Type: image/png
Size: 3693 bytes
Desc: not available
URL: <http://lists.osgeo.org/pipermail/postgis-users/attachments/20070224/7dd26854/attachment.png>


More information about the postgis-users mailing list