I am trying to rotate a Polygon type(see below) with the center of rotation(not necessary in the center) but somewhere within the boundary. How can I do this?

enter image description here

I am looking at rotate and affine_transform. The polygon vertex point (4 corner) is in meters (dimension) which i will need to transform it to lat lon in EPSG:4326 later stage

I was tempted to use rotate since parameter to use as it is simple ie rotate(geom, degree, centerofrotation) but was told that it does not work for lat lon coordinates.

To use affine transform, can anyone show me how to calculate for the transform matrix?

for example, the polygon is

POLYGON ((11576467.24265137 150763.0256523852, 11576467.24265137 150805.3789849052, 11576509.04265061 150805.3789849052, 11576509.04265061 150763.0256523852, 11576467.24265137 150763.0256523852))

and center of rotation (11576488.142650992, 150779.6256524612)


1 Answer 1


Shapely's rotate truly does not work with latitude-longitude (non-planar) coordinates. However, that doesn't seem to be your case!

The example coordinates you provided seem to be planar (in meters). Then, you can use any planar geometry opertations such as rotation, and project to EPSG:4326 (WGS84 latlon) afterwards, the result will be geographically valid.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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