Simplify meters per unit handling

This commit is contained in:
Andreas Hocevar
2016-01-06 13:46:29 +01:00
parent 607d8ad154
commit 24f8cba0a1
5 changed files with 37 additions and 13 deletions

View File

@@ -554,7 +554,8 @@ describe('ol.proj', function() {
it('returns value in meters', function() {
var epsg4326 = ol.proj.get('EPSG:4326');
expect(epsg4326.getMetersPerUnit()).to.eql(111194.87428468118);
expect(epsg4326.getMetersPerUnit()).to.eql(
ol.proj.EPSG4326.METERS_PER_UNIT);
});
it('works for proj4js projections without units', function() {
@@ -582,6 +583,7 @@ describe('ol.proj', function() {
goog.require('ol.proj');
goog.require('ol.proj.EPSG4326');
goog.require('ol.proj.Projection');
goog.require('ol.proj.Units');
goog.require('ol.proj.common');

View File

@@ -31,7 +31,8 @@ describe('ol.reproj', function() {
var resolution3857 = ol.reproj.calculateSourceResolution(
proj3857, proj4326, point4326, resolution4326);
expect(resolution3857).not.to.be(resolution4326);
expect(resolution3857).to.roughlyEqual(555974.3714343394, 1e-6);
expect(resolution3857).to.roughlyEqual(
5 * proj4326.getMetersPerUnit(), 1e-4);
var result = ol.reproj.calculateSourceResolution(
proj4326, proj3857, point3857, resolution3857);