Explicitly pass coordinate dimension before transforming
This commit is contained in:
+1
-1
@@ -678,7 +678,7 @@ ol.proj.cloneTransform = function(input, opt_output, opt_dimension) {
|
|||||||
*/
|
*/
|
||||||
ol.proj.transform = function(coordinate, source, destination) {
|
ol.proj.transform = function(coordinate, source, destination) {
|
||||||
var transformFn = ol.proj.getTransform(source, destination);
|
var transformFn = ol.proj.getTransform(source, destination);
|
||||||
return transformFn(coordinate);
|
return transformFn(coordinate, undefined, coordinate.length);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -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() {
|
describe('ol.proj.Projection.prototype.getMetersPerUnit()', function() {
|
||||||
|
|
||||||
beforeEach(function() {
|
beforeEach(function() {
|
||||||
|
|||||||
Reference in New Issue
Block a user