Use ol.sphere.NORMAL.radius instead of 6378000

to be consistent.
This commit is contained in:
Bruno Binet
2013-03-06 12:18:37 +01:00
parent 097d59c41a
commit f4aa08ee90
2 changed files with 3 additions and 2 deletions

View File

@@ -37,7 +37,8 @@ ol.ProjectionUnits = {
* @const {Object.<ol.ProjectionUnits, number>} Meters per unit lookup table.
*/
ol.METERS_PER_UNIT = {};
ol.METERS_PER_UNIT[ol.ProjectionUnits.DEGREES] = 2 * Math.PI * 6378000 / 360;
ol.METERS_PER_UNIT[ol.ProjectionUnits.DEGREES] =
2 * Math.PI * ol.sphere.NORMAL.radius / 360;
ol.METERS_PER_UNIT[ol.ProjectionUnits.FEET] = 0.02540005080010160020;
ol.METERS_PER_UNIT[ol.ProjectionUnits.METERS] = 1;

View File

@@ -308,7 +308,7 @@ describe('ol.projection', function() {
it('returns value in meters', function() {
var epsg4326 = ol.projection.getFromCode('EPSG:4326');
expect(epsg4326.getMetersPerUnit()).toEqual(111317.09969219835);
expect(epsg4326.getMetersPerUnit()).toEqual(111194.87428468118);
});
});