Fix comparison of projections with same code but different units
This commit is contained in:
@@ -677,7 +677,8 @@ ol.proj.get = function(projectionLike) {
|
||||
ol.proj.equivalent = function(projection1, projection2) {
|
||||
if (projection1 === projection2) {
|
||||
return true;
|
||||
} else if (projection1.getCode() === projection2.getCode()) {
|
||||
} else if (projection1.getCode() === projection2.getCode() &&
|
||||
projection1.getUnits() === projection2.getUnits()) {
|
||||
return true;
|
||||
} else if (projection1.getUnits() != projection2.getUnits()) {
|
||||
return false;
|
||||
|
||||
@@ -56,6 +56,19 @@ describe('ol.proj', function() {
|
||||
'EPSG:4326'
|
||||
]);
|
||||
});
|
||||
|
||||
it('requires code and units to be equal for projection evquivalence',
|
||||
function() {
|
||||
var proj1 = new ol.proj.Projection({
|
||||
code: 'EPSG:3857',
|
||||
units: 'm'
|
||||
});
|
||||
var proj2 = new ol.proj.Projection({
|
||||
code: 'EPSG:3857',
|
||||
units: 'tile-pixels'
|
||||
});
|
||||
expect(ol.proj.equivalent(proj1, proj2)).to.not.be.ok();
|
||||
});
|
||||
});
|
||||
|
||||
describe('identify transform', function() {
|
||||
|
||||
Reference in New Issue
Block a user