Loading lib/common/adjust_lon.js +6 −1 Original line number Diff line number Diff line var TWO_PI = Math.PI * 2; // SPI is slightly greater than Math.PI, so values that exceed the -180..180 // degree range by a tiny amount don't get wrapped. This prevents points that // have drifted from their original location along the 180th meridian (due to // floating point error) from changing their sign. var SPI = 3.14159265359; var sign = require('./sign'); module.exports = function(x) { return (Math.abs(x) < Math.PI) ? x : (x - (sign(x) * TWO_PI)); return (Math.abs(x) <= SPI) ? x : (x - (sign(x) * TWO_PI)); }; No newline at end of file test/testData.js +13 −2 Original line number Diff line number Diff line Loading @@ -284,6 +284,17 @@ var testPoints = [ code:"+proj=krovak +lat_0=49.5 +lon_0=24.83333333333333 +alpha=30.28813972222222 +k=0.9999 +x_0=0 +y_0=0 +ellps=bessel +pm=greenwich +units=m +no_defs +towgs84=570.8,85.7,462.8,4.998,1.587,5.261,3.56", ll: [12.806988, 49.452262], xy: [-868208.61, -1095793.64] }, // check that coordinates at 180 and -180 deg. longitude don't wrap around { code: 'EPSG:3857', ll: [-180, 0], xy: [-20037508.342789, 0] }, { code: 'EPSG:3857', ll: [180, 0], xy: [20037508.342789, 0] } ]; if(typeof module !== 'undefined'){ Loading Loading
lib/common/adjust_lon.js +6 −1 Original line number Diff line number Diff line var TWO_PI = Math.PI * 2; // SPI is slightly greater than Math.PI, so values that exceed the -180..180 // degree range by a tiny amount don't get wrapped. This prevents points that // have drifted from their original location along the 180th meridian (due to // floating point error) from changing their sign. var SPI = 3.14159265359; var sign = require('./sign'); module.exports = function(x) { return (Math.abs(x) < Math.PI) ? x : (x - (sign(x) * TWO_PI)); return (Math.abs(x) <= SPI) ? x : (x - (sign(x) * TWO_PI)); }; No newline at end of file
test/testData.js +13 −2 Original line number Diff line number Diff line Loading @@ -284,6 +284,17 @@ var testPoints = [ code:"+proj=krovak +lat_0=49.5 +lon_0=24.83333333333333 +alpha=30.28813972222222 +k=0.9999 +x_0=0 +y_0=0 +ellps=bessel +pm=greenwich +units=m +no_defs +towgs84=570.8,85.7,462.8,4.998,1.587,5.261,3.56", ll: [12.806988, 49.452262], xy: [-868208.61, -1095793.64] }, // check that coordinates at 180 and -180 deg. longitude don't wrap around { code: 'EPSG:3857', ll: [-180, 0], xy: [-20037508.342789, 0] }, { code: 'EPSG:3857', ll: [180, 0], xy: [20037508.342789, 0] } ]; if(typeof module !== 'undefined'){ Loading