I am using Azimuthal Equidistant Projection to plot points in a map being drawn in an Android application.
The origin is the centre of the map.
I have the formulas from here and here. I am getting expected results.
Simplified version of the code being used by me in JavaScript:
// Add functions to Math
if (!Math.toRadians)
Math.toRadians = function(angledeg) {
return angledeg * Math.PI / 180;
};
if (!Math.toDegrees)
Math.toDegrees = function(anglerad) {
return anglerad * 180 / Math.PI;
};
/* Mean radius of Earth (in metres)*/
const WGS_1984_R = 6370997;
/* Function to convert geodetic coordinates to Azimuthal Equidistant Projection projection (cartesian metres)*/
function convertGeodeticToAEP(longitude, latitude, longitudeOrigin, latitudeOrigin) {
var deltaLongitudes = Math.toRadians(longitude - longitudeOrigin),
cosDeltaLongitudes = Math.cos(deltaLongitudes),
cosLatitude = Math.cos(Math.toRadians(latitude)),
sinLatitude = Math.sin(Math.toRadians(latitude)),
cosLatitudeOrigin = Math.cos(Math.toRadians(latitudeOrigin)),
sinLatitudeOrigin = Math.sin(Math.toRadians(latitudeOrigin)),
// Angular distance from the centre
c = Math.acos(sinLatitudeOrigin * sinLatitude + cosLatitudeOrigin * cosLatitude * cosDeltaLongitudes),
k = c == 0 ? 0 : c / Math.sin(c),
x = k * cosLatitude * Math.sin(deltaLongitudes) * WGS_1984_R,
y = k * (cosLatitudeOrigin * sinLatitude - sinLatitudeOrigin * cosLatitude * cosDeltaLongitudes) * WGS_1984_R;
return {x: x, y: y};
}
What would be the formulas to rotate the projection by a given angle, from the origin? Say modify the function to include an additional parameter for angle of rotation and then modify the output accordingly...