Closed dowhileforeach closed 1 year ago
The expected range of longitude is ±180, so 200 is the same as -160.
Surprisingly, proj4js has exactly the same bug:
const proj4 = require('proj4');
const proj = proj4('+proj=merc +lon_0=50 +ellps=WGS84 +datum=WGS84');
console.log(proj.forward([200,0])); // --> [16697923.618991036, 0]
console.log(proj.inverse([16697923.618991036, 0])); // --> [-160, 0]
Apparently, there is some technical problem to take into account rotation by lambda when converting proToGeo...
It’s not a bug. That’s the expected behavior as I described due to the nature of spherical/cylindrical coordinates.
I create mercator converter with rotation by lambda -50 degrees:
Direct conversion from geographic coordinates of the point
[200, 0]
to a projection works fine:But the inverse conversion of the same projection point
[880.4166666666667, 250]
leads to an incorrect result:shouldn't the result of the inverse conversion be close to the point
[200, 0]
?Check It. Stackblitz