1

I need to use OpenLayers to rotate polygons directly with the mouse. For this I use ol-ext which works perfectly.

My problem:
I store the angles in degrees in the database and I need the conversion to radian when I load my page.
I store them in degrees for practical reasons in my user editing panel.

This equation of radians to degrees works perfectly:
(e.angle * 180 / Math.PI - 180) % 360 + 180
So I try to find its opposite but without success, here are some examples of correspondences:

//    deg  ->    rad
// -178.33 -> -3.112424297335325
//  178.69 -> -3.164490064610729

//  70.31  ->  1.22
//  71.62  -> -5.033133821377763

//  -1.15  -> -0.02002663689020867
//   1.24  ->  0.02167345873189741

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.