I am trying to measure different angles on 2D map using lat/lon coordinates taken from Google Maps, and Java library JTS.
I have noticed a weird thing: my measurements are always distorted, except angles that are perpendicular to meridians and parallels. It gets as high as 25 degrees when the angle sides are at an angle of 45 degrees to the parallalels, example here:
The result is 68.97 and the library I use uses the law of cosines to measure the angle. I also double checked the result using the method provided here, and the difference was still there.
Here's the Java code:
double point2X = 2.35956;
double point2Y = 48.86054;
double point1X = 2.35922;
double point1Y = 48.86215;
double fixedX = 2.3582;
double fixedY = 48.86124;
double angle1 = Math.atan2(point1Y - fixedY, point1X - fixedX);
double angle2 = Math.atan2(point2Y - fixedY, point2X - fixedX);
return Math.toDegrees(angle1 - angle2);
Or as done using JTS:
Coordinate point1 = new Coordinate(2.35922, 48.86215);
Coordinate point2 = new Coordinate(2.35956, 48.86054);
Coordinate fixed = new Coordinate(2.3582, 48.86124);
return Math.toDegrees(Angle.angleBetween(point1, fixed, point2));
And here is a JS fiddle showing the calculations:
I found out that Web Mercator is non-conformal, thus it doesn't preserve angles, but does it get as bad for even such small areas as presented above?