Merge pull request #11719 from ahocevar/less-aggressie-3857-clamping

Clamp EPSG:3857 y to lowest/highest possible value instead of validity extent
This commit is contained in:
Andreas Hocevar
2020-11-19 13:51:47 +01:00
committed by GitHub
2 changed files with 20 additions and 10 deletions

View File

@@ -1,4 +1,8 @@
import {HALF_SIZE, fromEPSG4326} from '../../../../src/ol/proj/epsg3857.js';
import {
HALF_SIZE,
MAX_SAFE_Y,
fromEPSG4326,
} from '../../../../src/ol/proj/epsg3857.js';
import {
addCommon,
clearAllProjections,
@@ -24,11 +28,11 @@ describe('ol/proj/epsg3857', function () {
},
{
g: [-180, -90],
m: [-HALF_SIZE, -HALF_SIZE],
m: [-HALF_SIZE, -MAX_SAFE_Y],
},
{
g: [180, 90],
m: [HALF_SIZE, HALF_SIZE],
m: [HALF_SIZE, MAX_SAFE_Y],
},
{
g: [-111.0429, 45.677],
@@ -47,7 +51,7 @@ describe('ol/proj/epsg3857', function () {
it('does not produce unexpected results for string coordinates', function () {
const transformed = fromEPSG4326(['180', '90']);
expect(transformed[0]).to.roughlyEqual(HALF_SIZE, 1e-5);
expect(transformed[1]).to.roughlyEqual(HALF_SIZE, 1e-5);
expect(transformed[1]).to.roughlyEqual(MAX_SAFE_Y, 1e-5);
});
});