Use number literal for sphere radii
This commit is contained in:
@@ -31,6 +31,8 @@ ol.inherits(ol.proj.EPSG3857.Projection_, ol.proj.Projection);
|
|||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Radius of WGS84 sphere
|
||||||
|
*
|
||||||
* @const
|
* @const
|
||||||
* @type {number}
|
* @type {number}
|
||||||
*/
|
*/
|
||||||
|
|||||||
+10
-2
@@ -3,7 +3,6 @@ goog.provide('ol.proj.EPSG4326');
|
|||||||
goog.require('ol');
|
goog.require('ol');
|
||||||
goog.require('ol.proj.Projection');
|
goog.require('ol.proj.Projection');
|
||||||
goog.require('ol.proj.Units');
|
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);
|
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.
|
* Extent of the EPSG:4326 projection which is the whole world.
|
||||||
*
|
*
|
||||||
@@ -47,7 +55,7 @@ ol.proj.EPSG4326.EXTENT = [-180, -90, 180, 90];
|
|||||||
* @const
|
* @const
|
||||||
* @type {number}
|
* @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;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -1,7 +1,5 @@
|
|||||||
goog.provide('ol.proj.Units');
|
goog.provide('ol.proj.Units');
|
||||||
|
|
||||||
goog.require('ol.sphere.NORMAL');
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Projection units: `'degrees'`, `'ft'`, `'m'`, `'pixels'`, `'tile-pixels'` or
|
* Projection units: `'degrees'`, `'ft'`, `'m'`, `'pixels'`, `'tile-pixels'` or
|
||||||
@@ -25,8 +23,9 @@ ol.proj.Units = {
|
|||||||
* @api
|
* @api
|
||||||
*/
|
*/
|
||||||
ol.proj.Units.METERS_PER_UNIT = {};
|
ol.proj.Units.METERS_PER_UNIT = {};
|
||||||
|
// use the radius of the Normal sphere
|
||||||
ol.proj.Units.METERS_PER_UNIT[ol.proj.Units.DEGREES] =
|
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.FEET] = 0.3048;
|
||||||
ol.proj.Units.METERS_PER_UNIT[ol.proj.Units.METERS] = 1;
|
ol.proj.Units.METERS_PER_UNIT[ol.proj.Units.METERS] = 1;
|
||||||
ol.proj.Units.METERS_PER_UNIT[ol.proj.Units.USFEET] = 1200 / 3937;
|
ol.proj.Units.METERS_PER_UNIT[ol.proj.Units.USFEET] = 1200 / 3937;
|
||||||
|
|||||||
Reference in New Issue
Block a user