Explicitly pass coordinate dimension before transforming

This commit is contained in:
Tim Schaub
2014-10-27 10:33:46 -06:00
parent aa41da1318
commit 8a82048c12
2 changed files with 29 additions and 1 deletions

View File

@@ -316,6 +316,34 @@ describe('ol.proj', function() {
});
describe('ol.proj.transform()', function() {
it('transforms a 2d coordinate', function() {
var got = ol.proj.transform([-10, -20], 'EPSG:4326', 'EPSG:3857');
expect(got).to.have.length(2);
expect(got[0]).to.roughlyEqual(-1113194.9079327357, 1e-3);
expect(got[1]).to.roughlyEqual(-2273030.92698769, 1e-3);
});
it('transforms a 3d coordinate', function() {
var got = ol.proj.transform([-10, -20, 3], 'EPSG:4326', 'EPSG:3857');
expect(got).to.have.length(3);
expect(got[0]).to.roughlyEqual(-1113194.9079327357, 1e-3);
expect(got[1]).to.roughlyEqual(-2273030.92698769, 1e-3);
expect(got[2]).to.be(3);
});
it('transforms a 4d coordinate', function() {
var got = ol.proj.transform([-10, -20, 3, 4], 'EPSG:4326', 'EPSG:3857');
expect(got).to.have.length(4);
expect(got[0]).to.roughlyEqual(-1113194.9079327357, 1e-3);
expect(got[1]).to.roughlyEqual(-2273030.92698769, 1e-3);
expect(got[2]).to.be(3);
expect(got[3]).to.be(4);
});
});
describe('ol.proj.Projection.prototype.getMetersPerUnit()', function() {
beforeEach(function() {