From 49dcda7794ab0519a86fcaf1c956199b5e454fc2 Mon Sep 17 00:00:00 2001 From: Peter Robins Date: Fri, 9 Jun 2017 10:29:59 +0000 Subject: [PATCH] Use number literal for sphere radii --- src/ol/proj/epsg3857.js | 2 ++ src/ol/proj/epsg4326.js | 12 ++++++++++-- src/ol/proj/units.js | 5 ++--- 3 files changed, 14 insertions(+), 5 deletions(-) diff --git a/src/ol/proj/epsg3857.js b/src/ol/proj/epsg3857.js index b6fb3b5e46..361ead8c14 100644 --- a/src/ol/proj/epsg3857.js +++ b/src/ol/proj/epsg3857.js @@ -31,6 +31,8 @@ ol.inherits(ol.proj.EPSG3857.Projection_, ol.proj.Projection); /** + * Radius of WGS84 sphere + * * @const * @type {number} */ diff --git a/src/ol/proj/epsg4326.js b/src/ol/proj/epsg4326.js index cccff1741a..373f1d44a4 100644 --- a/src/ol/proj/epsg4326.js +++ b/src/ol/proj/epsg4326.js @@ -3,7 +3,6 @@ goog.provide('ol.proj.EPSG4326'); goog.require('ol'); goog.require('ol.proj.Projection'); goog.require('ol.proj.Units'); -goog.require('ol.sphere.WGS84'); /** @@ -34,6 +33,15 @@ ol.proj.EPSG4326.Projection_ = function(code, opt_axisOrientation) { ol.inherits(ol.proj.EPSG4326.Projection_, ol.proj.Projection); +/** + * Radius of WGS84 sphere + * + * @const + * @type {number} + */ +ol.proj.EPSG4326.RADIUS = 6378137; + + /** * Extent of the EPSG:4326 projection which is the whole world. * @@ -47,7 +55,7 @@ ol.proj.EPSG4326.EXTENT = [-180, -90, 180, 90]; * @const * @type {number} */ -ol.proj.EPSG4326.METERS_PER_UNIT = Math.PI * ol.sphere.WGS84.radius / 180; +ol.proj.EPSG4326.METERS_PER_UNIT = Math.PI * ol.proj.EPSG4326.RADIUS / 180; /** diff --git a/src/ol/proj/units.js b/src/ol/proj/units.js index 7b735c839d..d122e82227 100644 --- a/src/ol/proj/units.js +++ b/src/ol/proj/units.js @@ -1,7 +1,5 @@ goog.provide('ol.proj.Units'); -goog.require('ol.sphere.NORMAL'); - /** * Projection units: `'degrees'`, `'ft'`, `'m'`, `'pixels'`, `'tile-pixels'` or @@ -25,8 +23,9 @@ ol.proj.Units = { * @api */ ol.proj.Units.METERS_PER_UNIT = {}; +// use the radius of the Normal sphere ol.proj.Units.METERS_PER_UNIT[ol.proj.Units.DEGREES] = - 2 * Math.PI * ol.sphere.NORMAL.radius / 360; + 2 * Math.PI * 6370997 / 360; ol.proj.Units.METERS_PER_UNIT[ol.proj.Units.FEET] = 0.3048; ol.proj.Units.METERS_PER_UNIT[ol.proj.Units.METERS] = 1; ol.proj.Units.METERS_PER_UNIT[ol.proj.Units.USFEET] = 1200 / 3937;