[proj4js] 01/06: Imported Upstream version 2.3.11+ds

Sebastiaan Couwenberg sebastic at moszumanska.debian.org
Sat Oct 10 10:09:42 UTC 2015


This is an automated email from the git hooks/post-receive script.

sebastic pushed a commit to branch master
in repository proj4js.

commit f55a1be97db9a34dc0ba93c68140ea7b8848ce50
Author: Bas Couwenberg <sebastic at xs4all.nl>
Date:   Sat Oct 10 11:44:11 2015 +0200

    Imported Upstream version 2.3.11+ds
---
 bower.json        |   2 +-
 component.json    |   2 +-
 dist/proj4-src.js | 175 +++++++++++++++++++++---------------------------------
 lib/datum.js      |  21 ++++---
 lib/wkt.js        |   8 ++-
 package.json      |   2 +-
 test/test.js      |  10 ++++
 7 files changed, 98 insertions(+), 122 deletions(-)

diff --git a/bower.json b/bower.json
index 2c7d8b9..d21e9ed 100644
--- a/bower.json
+++ b/bower.json
@@ -1,6 +1,6 @@
 {
   "name": "proj4",
-  "version": "2.3.10-alpha",
+  "version": "2.3.11-alpha",
   "description": "Proj4js is a JavaScript library to transform point coordinates from one coordinate system to another, including datum transformations.",
   "homepage": "https://github.com/proj4js/proj4js",
   "main": "dist/proj4.js",
diff --git a/component.json b/component.json
index 325c045..36a6ce6 100644
--- a/component.json
+++ b/component.json
@@ -1,6 +1,6 @@
 {
   "name": "proj4",
-  "version": "2.3.10-alpha",
+  "version": "2.3.11-alpha",
   "description": "Proj4js is a JavaScript library to transform point coordinates from one coordinate system to another, including datum transformations.",
   "repo": "proj4js/proj4js",
   "keywords": [
diff --git a/dist/proj4-src.js b/dist/proj4-src.js
index 4916da3..2e8aec8 100644
--- a/dist/proj4-src.js
+++ b/dist/proj4-src.js
@@ -34,7 +34,7 @@ Point.prototype.toMGRS = function(accuracy) {
   return mgrs.forward([this.x, this.y], accuracy);
 };
 module.exports = Point;
-},{"mgrs":67}],2:[function(_dereq_,module,exports){
+},{"mgrs":66}],2:[function(_dereq_,module,exports){
 var parseCode = _dereq_("./parseCode");
 var extend = _dereq_('./extend');
 var projections = _dereq_('./projections');
@@ -69,7 +69,7 @@ Projection.projections = projections;
 Projection.projections.start();
 module.exports = Projection;
 
-},{"./deriveConstants":33,"./extend":34,"./parseCode":37,"./projections":39}],3:[function(_dereq_,module,exports){
+},{"./deriveConstants":32,"./extend":33,"./parseCode":36,"./projections":38}],3:[function(_dereq_,module,exports){
 module.exports = function(crs, denorm, point) {
   var xin = point.x,
     yin = point.y,
@@ -131,15 +131,10 @@ module.exports = function(x) {
 };
 },{"./sign":21}],5:[function(_dereq_,module,exports){
 var TWO_PI = Math.PI * 2;
-// SPI is slightly greater than Math.PI, so values that exceed the -180..180
-// degree range by a tiny amount don't get wrapped. This prevents points that
-// have drifted from their original location along the 180th meridian (due to
-// floating point error) from changing their sign.
-var SPI = 3.14159265359;
 var sign = _dereq_('./sign');
 
 module.exports = function(x) {
-  return (Math.abs(x) <= SPI) ? x : (x - (sign(x) * TWO_PI));
+  return (Math.abs(x) < Math.PI) ? x : (x - (sign(x) * TWO_PI));
 };
 },{"./sign":21}],6:[function(_dereq_,module,exports){
 module.exports = function(x) {
@@ -651,10 +646,6 @@ exports.stockholm = 18.058277777778; //"18d3'29.8\"E",
 exports.athens = 23.7163375; //"23d42'58.815\"E",
 exports.oslo = 10.722916666667; //"10d43'22.5\"E"
 },{}],28:[function(_dereq_,module,exports){
-exports.ft = {to_meter: 0.3048};
-exports['us-ft'] = {to_meter: 1200 / 3937};
-
-},{}],29:[function(_dereq_,module,exports){
 var proj = _dereq_('./Proj');
 var transform = _dereq_('./transform');
 var wgs84 = proj('WGS84');
@@ -719,7 +710,7 @@ function proj4(fromProj, toProj, coord) {
   }
 }
 module.exports = proj4;
-},{"./Proj":2,"./transform":65}],30:[function(_dereq_,module,exports){
+},{"./Proj":2,"./transform":64}],29:[function(_dereq_,module,exports){
 var HALF_PI = Math.PI/2;
 var PJD_3PARAM = 1;
 var PJD_7PARAM = 2;
@@ -1125,7 +1116,7 @@ datum.prototype = {
 */
 module.exports = datum;
 
-},{}],31:[function(_dereq_,module,exports){
+},{}],30:[function(_dereq_,module,exports){
 var PJD_3PARAM = 1;
 var PJD_7PARAM = 2;
 var PJD_GRIDSHIFT = 3;
@@ -1226,7 +1217,7 @@ module.exports = function(source, dest, point) {
 };
 
 
-},{}],32:[function(_dereq_,module,exports){
+},{}],31:[function(_dereq_,module,exports){
 var globals = _dereq_('./global');
 var parseProj = _dereq_('./projString');
 var wkt = _dereq_('./wkt');
@@ -1237,7 +1228,7 @@ function defs(name) {
   if (arguments.length === 2) {
     var def = arguments[1];
     if (typeof def === 'string') {
-      if (def.charAt(0) === '+') {
+      if (def[0] === '+') {
         defs[name] = parseProj(arguments[1]);
       }
       else {
@@ -1283,7 +1274,7 @@ function defs(name) {
 globals(defs);
 module.exports = defs;
 
-},{"./global":35,"./projString":38,"./wkt":66}],33:[function(_dereq_,module,exports){
+},{"./global":34,"./projString":37,"./wkt":65}],32:[function(_dereq_,module,exports){
 var Datum = _dereq_('./constants/Datum');
 var Ellipsoid = _dereq_('./constants/Ellipsoid');
 var extend = _dereq_('./extend');
@@ -1335,13 +1326,10 @@ module.exports = function(json) {
     json.axis = "enu";
   }
 
-  if (!json.datum) {
-    json.datum = datum(json);
-  }
+  json.datum = datum(json);
   return json;
 };
-
-},{"./constants/Datum":25,"./constants/Ellipsoid":26,"./datum":30,"./extend":34}],34:[function(_dereq_,module,exports){
+},{"./constants/Datum":25,"./constants/Ellipsoid":26,"./datum":29,"./extend":33}],33:[function(_dereq_,module,exports){
 module.exports = function(destination, source) {
   destination = destination || {};
   var value, property;
@@ -1357,7 +1345,7 @@ module.exports = function(destination, source) {
   return destination;
 };
 
-},{}],35:[function(_dereq_,module,exports){
+},{}],34:[function(_dereq_,module,exports){
 module.exports = function(defs) {
   defs('EPSG:4326', "+title=WGS 84 (long/lat) +proj=longlat +ellps=WGS84 +datum=WGS84 +units=degrees");
   defs('EPSG:4269', "+title=NAD83 (long/lat) +proj=longlat +a=6378137.0 +b=6356752.31414036 +ellps=GRS80 +datum=NAD83 +units=degrees");
@@ -1370,7 +1358,7 @@ module.exports = function(defs) {
   defs['EPSG:102113'] = defs['EPSG:3857'];
 };
 
-},{}],36:[function(_dereq_,module,exports){
+},{}],35:[function(_dereq_,module,exports){
 var proj4 = _dereq_('./core');
 proj4.defaultDatum = 'WGS84'; //default datum
 proj4.Proj = _dereq_('./Proj');
@@ -1383,7 +1371,7 @@ proj4.mgrs = _dereq_('mgrs');
 proj4.version = _dereq_('../package.json').version;
 _dereq_('./includedProjections')(proj4);
 module.exports = proj4;
-},{"../package.json":68,"./Point":1,"./Proj":2,"./common/toPoint":23,"./core":29,"./defs":32,"./includedProjections":"hTEDpn","./transform":65,"mgrs":67}],37:[function(_dereq_,module,exports){
+},{"../package.json":67,"./Point":1,"./Proj":2,"./common/toPoint":23,"./core":28,"./defs":31,"./includedProjections":"gWUPNW","./transform":64,"mgrs":66}],36:[function(_dereq_,module,exports){
 var defs = _dereq_('./defs');
 var wkt = _dereq_('./wkt');
 var projStr = _dereq_('./projString');
@@ -1420,13 +1408,12 @@ function parse(code){
 }
 
 module.exports = parse;
-},{"./defs":32,"./projString":38,"./wkt":66}],38:[function(_dereq_,module,exports){
+},{"./defs":31,"./projString":37,"./wkt":65}],37:[function(_dereq_,module,exports){
 var D2R = 0.01745329251994329577;
 var PrimeMeridian = _dereq_('./constants/PrimeMeridian');
-var units = _dereq_('./constants/units');
-
 module.exports = function(defData) {
   var self = {};
+
   var paramObj = {};
   defData.split("+").map(function(v) {
     return v.trim();
@@ -1442,7 +1429,7 @@ module.exports = function(defData) {
     proj: 'projName',
     datum: 'datumCode',
     rf: function(v) {
-      self.rf = parseFloat(v);
+      self.rf = parseFloat(v, 10);
     },
     lat_0: function(v) {
       self.lat0 = v * D2R;
@@ -1472,22 +1459,16 @@ module.exports = function(defData) {
       self.longc = v * D2R;
     },
     x_0: function(v) {
-      self.x0 = parseFloat(v);
+      self.x0 = parseFloat(v, 10);
     },
     y_0: function(v) {
-      self.y0 = parseFloat(v);
+      self.y0 = parseFloat(v, 10);
     },
     k_0: function(v) {
-      self.k0 = parseFloat(v);
+      self.k0 = parseFloat(v, 10);
     },
     k: function(v) {
-      self.k0 = parseFloat(v);
-    },
-    a: function(v) {
-      self.a = parseFloat(v);
-    },
-    b: function(v) {
-      self.b = parseFloat(v);
+      self.k0 = parseFloat(v, 10);
     },
     r_a: function() {
       self.R_A = true;
@@ -1500,23 +1481,17 @@ module.exports = function(defData) {
     },
     towgs84: function(v) {
       self.datum_params = v.split(",").map(function(a) {
-        return parseFloat(a);
+        return parseFloat(a, 10);
       });
     },
     to_meter: function(v) {
-      self.to_meter = parseFloat(v);
-    },
-    units: function(v) {
-      self.units = v;
-      if (units[v]) {
-        self.to_meter = units[v].to_meter;
-      }
+      self.to_meter = parseFloat(v, 10);
     },
     from_greenwich: function(v) {
       self.from_greenwich = v * D2R;
     },
     pm: function(v) {
-      self.from_greenwich = (PrimeMeridian[v] ? PrimeMeridian[v] : parseFloat(v)) * D2R;
+      self.from_greenwich = (PrimeMeridian[v] ? PrimeMeridian[v] : parseFloat(v, 10)) * D2R;
     },
     nadgrids: function(v) {
       if (v === '@null') {
@@ -1554,7 +1529,7 @@ module.exports = function(defData) {
   return self;
 };
 
-},{"./constants/PrimeMeridian":27,"./constants/units":28}],39:[function(_dereq_,module,exports){
+},{"./constants/PrimeMeridian":27}],38:[function(_dereq_,module,exports){
 var projs = [
   _dereq_('./projections/merc'),
   _dereq_('./projections/longlat')
@@ -1590,7 +1565,7 @@ exports.start = function() {
   projs.forEach(add);
 };
 
-},{"./projections/longlat":51,"./projections/merc":52}],40:[function(_dereq_,module,exports){
+},{"./projections/longlat":50,"./projections/merc":51}],39:[function(_dereq_,module,exports){
 var EPSLN = 1.0e-10;
 var msfnz = _dereq_('../common/msfnz');
 var qsfnz = _dereq_('../common/qsfnz');
@@ -1713,7 +1688,7 @@ exports.phi1z = function(eccent, qs) {
 };
 exports.names = ["Albers_Conic_Equal_Area", "Albers", "aea"];
 
-},{"../common/adjust_lon":5,"../common/asinz":6,"../common/msfnz":15,"../common/qsfnz":20}],41:[function(_dereq_,module,exports){
+},{"../common/adjust_lon":5,"../common/asinz":6,"../common/msfnz":15,"../common/qsfnz":20}],40:[function(_dereq_,module,exports){
 var adjust_lon = _dereq_('../common/adjust_lon');
 var HALF_PI = Math.PI/2;
 var EPSLN = 1.0e-10;
@@ -1912,7 +1887,7 @@ exports.inverse = function(p) {
 };
 exports.names = ["Azimuthal_Equidistant", "aeqd"];
 
-},{"../common/adjust_lon":5,"../common/asinz":6,"../common/e0fn":7,"../common/e1fn":8,"../common/e2fn":9,"../common/e3fn":10,"../common/gN":11,"../common/imlfn":12,"../common/mlfn":14}],42:[function(_dereq_,module,exports){
+},{"../common/adjust_lon":5,"../common/asinz":6,"../common/e0fn":7,"../common/e1fn":8,"../common/e2fn":9,"../common/e3fn":10,"../common/gN":11,"../common/imlfn":12,"../common/mlfn":14}],41:[function(_dereq_,module,exports){
 var mlfn = _dereq_('../common/mlfn');
 var e0fn = _dereq_('../common/e0fn');
 var e1fn = _dereq_('../common/e1fn');
@@ -2016,7 +1991,7 @@ exports.inverse = function(p) {
 
 };
 exports.names = ["Cassini", "Cassini_Soldner", "cass"];
-},{"../common/adjust_lat":4,"../common/adjust_lon":5,"../common/e0fn":7,"../common/e1fn":8,"../common/e2fn":9,"../common/e3fn":10,"../common/gN":11,"../common/imlfn":12,"../common/mlfn":14}],43:[function(_dereq_,module,exports){
+},{"../common/adjust_lat":4,"../common/adjust_lon":5,"../common/e0fn":7,"../common/e1fn":8,"../common/e2fn":9,"../common/e3fn":10,"../common/gN":11,"../common/imlfn":12,"../common/mlfn":14}],42:[function(_dereq_,module,exports){
 var adjust_lon = _dereq_('../common/adjust_lon');
 var qsfnz = _dereq_('../common/qsfnz');
 var msfnz = _dereq_('../common/msfnz');
@@ -2081,7 +2056,7 @@ exports.inverse = function(p) {
 };
 exports.names = ["cea"];
 
-},{"../common/adjust_lon":5,"../common/iqsfnz":13,"../common/msfnz":15,"../common/qsfnz":20}],44:[function(_dereq_,module,exports){
+},{"../common/adjust_lon":5,"../common/iqsfnz":13,"../common/msfnz":15,"../common/qsfnz":20}],43:[function(_dereq_,module,exports){
 var adjust_lon = _dereq_('../common/adjust_lon');
 var adjust_lat = _dereq_('../common/adjust_lat');
 exports.init = function() {
@@ -2124,7 +2099,7 @@ exports.inverse = function(p) {
 };
 exports.names = ["Equirectangular", "Equidistant_Cylindrical", "eqc"];
 
-},{"../common/adjust_lat":4,"../common/adjust_lon":5}],45:[function(_dereq_,module,exports){
+},{"../common/adjust_lat":4,"../common/adjust_lon":5}],44:[function(_dereq_,module,exports){
 var e0fn = _dereq_('../common/e0fn');
 var e1fn = _dereq_('../common/e1fn');
 var e2fn = _dereq_('../common/e2fn');
@@ -2236,7 +2211,7 @@ exports.inverse = function(p) {
 };
 exports.names = ["Equidistant_Conic", "eqdc"];
 
-},{"../common/adjust_lat":4,"../common/adjust_lon":5,"../common/e0fn":7,"../common/e1fn":8,"../common/e2fn":9,"../common/e3fn":10,"../common/imlfn":12,"../common/mlfn":14,"../common/msfnz":15}],46:[function(_dereq_,module,exports){
+},{"../common/adjust_lat":4,"../common/adjust_lon":5,"../common/e0fn":7,"../common/e1fn":8,"../common/e2fn":9,"../common/e3fn":10,"../common/imlfn":12,"../common/mlfn":14,"../common/msfnz":15}],45:[function(_dereq_,module,exports){
 var FORTPI = Math.PI/4;
 var srat = _dereq_('../common/srat');
 var HALF_PI = Math.PI/2;
@@ -2283,7 +2258,7 @@ exports.inverse = function(p) {
 };
 exports.names = ["gauss"];
 
-},{"../common/srat":22}],47:[function(_dereq_,module,exports){
+},{"../common/srat":22}],46:[function(_dereq_,module,exports){
 var adjust_lon = _dereq_('../common/adjust_lon');
 var EPSLN = 1.0e-10;
 var asinz = _dereq_('../common/asinz');
@@ -2384,7 +2359,7 @@ exports.inverse = function(p) {
 };
 exports.names = ["gnom"];
 
-},{"../common/adjust_lon":5,"../common/asinz":6}],48:[function(_dereq_,module,exports){
+},{"../common/adjust_lon":5,"../common/asinz":6}],47:[function(_dereq_,module,exports){
 var adjust_lon = _dereq_('../common/adjust_lon');
 exports.init = function() {
   this.a = 6377397.155;
@@ -2484,7 +2459,7 @@ exports.inverse = function(p) {
 };
 exports.names = ["Krovak", "krovak"];
 
-},{"../common/adjust_lon":5}],49:[function(_dereq_,module,exports){
+},{"../common/adjust_lon":5}],48:[function(_dereq_,module,exports){
 var HALF_PI = Math.PI/2;
 var FORTPI = Math.PI/4;
 var EPSLN = 1.0e-10;
@@ -2774,7 +2749,7 @@ exports.authlat = function(beta, APA) {
 };
 exports.names = ["Lambert Azimuthal Equal Area", "Lambert_Azimuthal_Equal_Area", "laea"];
 
-},{"../common/adjust_lon":5,"../common/qsfnz":20}],50:[function(_dereq_,module,exports){
+},{"../common/adjust_lon":5,"../common/qsfnz":20}],49:[function(_dereq_,module,exports){
 var EPSLN = 1.0e-10;
 var msfnz = _dereq_('../common/msfnz');
 var tsfnz = _dereq_('../common/tsfnz');
@@ -2911,7 +2886,7 @@ exports.inverse = function(p) {
 
 exports.names = ["Lambert Tangential Conformal Conic Projection", "Lambert_Conformal_Conic", "Lambert_Conformal_Conic_2SP", "lcc"];
 
-},{"../common/adjust_lon":5,"../common/msfnz":15,"../common/phi2z":16,"../common/sign":21,"../common/tsfnz":24}],51:[function(_dereq_,module,exports){
+},{"../common/adjust_lon":5,"../common/msfnz":15,"../common/phi2z":16,"../common/sign":21,"../common/tsfnz":24}],50:[function(_dereq_,module,exports){
 exports.init = function() {
   //no-op for longlat
 };
@@ -2923,7 +2898,7 @@ exports.forward = identity;
 exports.inverse = identity;
 exports.names = ["longlat", "identity"];
 
-},{}],52:[function(_dereq_,module,exports){
+},{}],51:[function(_dereq_,module,exports){
 var msfnz = _dereq_('../common/msfnz');
 var HALF_PI = Math.PI/2;
 var EPSLN = 1.0e-10;
@@ -3022,7 +2997,7 @@ exports.inverse = function(p) {
 
 exports.names = ["Mercator", "Popular Visualisation Pseudo Mercator", "Mercator_1SP", "Mercator_Auxiliary_Sphere", "merc"];
 
-},{"../common/adjust_lon":5,"../common/msfnz":15,"../common/phi2z":16,"../common/tsfnz":24}],53:[function(_dereq_,module,exports){
+},{"../common/adjust_lon":5,"../common/msfnz":15,"../common/phi2z":16,"../common/tsfnz":24}],52:[function(_dereq_,module,exports){
 var adjust_lon = _dereq_('../common/adjust_lon');
 /*
   reference
@@ -3069,7 +3044,7 @@ exports.inverse = function(p) {
 };
 exports.names = ["Miller_Cylindrical", "mill"];
 
-},{"../common/adjust_lon":5}],54:[function(_dereq_,module,exports){
+},{"../common/adjust_lon":5}],53:[function(_dereq_,module,exports){
 var adjust_lon = _dereq_('../common/adjust_lon');
 var EPSLN = 1.0e-10;
 exports.init = function() {};
@@ -3148,7 +3123,7 @@ exports.inverse = function(p) {
 };
 exports.names = ["Mollweide", "moll"];
 
-},{"../common/adjust_lon":5}],55:[function(_dereq_,module,exports){
+},{"../common/adjust_lon":5}],54:[function(_dereq_,module,exports){
 var SEC_TO_RAD = 4.84813681109535993589914102357e-6;
 /*
   reference
@@ -3368,7 +3343,7 @@ exports.inverse = function(p) {
   return p;
 };
 exports.names = ["New_Zealand_Map_Grid", "nzmg"];
-},{}],56:[function(_dereq_,module,exports){
+},{}],55:[function(_dereq_,module,exports){
 var tsfnz = _dereq_('../common/tsfnz');
 var adjust_lon = _dereq_('../common/adjust_lon');
 var phi2z = _dereq_('../common/phi2z');
@@ -3537,7 +3512,7 @@ exports.inverse = function(p) {
 };
 
 exports.names = ["Hotine_Oblique_Mercator", "Hotine Oblique Mercator", "Hotine_Oblique_Mercator_Azimuth_Natural_Origin", "Hotine_Oblique_Mercator_Azimuth_Center", "omerc"];
-},{"../common/adjust_lon":5,"../common/phi2z":16,"../common/tsfnz":24}],57:[function(_dereq_,module,exports){
+},{"../common/adjust_lon":5,"../common/phi2z":16,"../common/tsfnz":24}],56:[function(_dereq_,module,exports){
 var e0fn = _dereq_('../common/e0fn');
 var e1fn = _dereq_('../common/e1fn');
 var e2fn = _dereq_('../common/e2fn');
@@ -3666,7 +3641,7 @@ exports.inverse = function(p) {
   return p;
 };
 exports.names = ["Polyconic", "poly"];
-},{"../common/adjust_lat":4,"../common/adjust_lon":5,"../common/e0fn":7,"../common/e1fn":8,"../common/e2fn":9,"../common/e3fn":10,"../common/gN":11,"../common/mlfn":14}],58:[function(_dereq_,module,exports){
+},{"../common/adjust_lat":4,"../common/adjust_lon":5,"../common/e0fn":7,"../common/e1fn":8,"../common/e2fn":9,"../common/e3fn":10,"../common/gN":11,"../common/mlfn":14}],57:[function(_dereq_,module,exports){
 var adjust_lon = _dereq_('../common/adjust_lon');
 var adjust_lat = _dereq_('../common/adjust_lat');
 var pj_enfn = _dereq_('../common/pj_enfn');
@@ -3773,7 +3748,7 @@ exports.inverse = function(p) {
   return p;
 };
 exports.names = ["Sinusoidal", "sinu"];
-},{"../common/adjust_lat":4,"../common/adjust_lon":5,"../common/asinz":6,"../common/pj_enfn":17,"../common/pj_inv_mlfn":18,"../common/pj_mlfn":19}],59:[function(_dereq_,module,exports){
+},{"../common/adjust_lat":4,"../common/adjust_lon":5,"../common/asinz":6,"../common/pj_enfn":17,"../common/pj_inv_mlfn":18,"../common/pj_mlfn":19}],58:[function(_dereq_,module,exports){
 /*
   references:
     Formules et constantes pour le Calcul pour la
@@ -3855,7 +3830,7 @@ exports.inverse = function(p) {
 
 exports.names = ["somerc"];
 
-},{}],60:[function(_dereq_,module,exports){
+},{}],59:[function(_dereq_,module,exports){
 var HALF_PI = Math.PI/2;
 var EPSLN = 1.0e-10;
 var sign = _dereq_('../common/sign');
@@ -4021,9 +3996,8 @@ exports.inverse = function(p) {
   return p;
 
 };
-exports.names = ["stere", "Stereographic_South_Pole", "Polar Stereographic (variant B)"];
-
-},{"../common/adjust_lon":5,"../common/msfnz":15,"../common/phi2z":16,"../common/sign":21,"../common/tsfnz":24}],61:[function(_dereq_,module,exports){
+exports.names = ["stere"];
+},{"../common/adjust_lon":5,"../common/msfnz":15,"../common/phi2z":16,"../common/sign":21,"../common/tsfnz":24}],60:[function(_dereq_,module,exports){
 var gauss = _dereq_('./gauss');
 var adjust_lon = _dereq_('../common/adjust_lon');
 exports.init = function() {
@@ -4082,7 +4056,7 @@ exports.inverse = function(p) {
 
 exports.names = ["Stereographic_North_Pole", "Oblique_Stereographic", "Polar_Stereographic", "sterea","Oblique Stereographic Alternative"];
 
-},{"../common/adjust_lon":5,"./gauss":46}],62:[function(_dereq_,module,exports){
+},{"../common/adjust_lon":5,"./gauss":45}],61:[function(_dereq_,module,exports){
 var e0fn = _dereq_('../common/e0fn');
 var e1fn = _dereq_('../common/e1fn');
 var e2fn = _dereq_('../common/e2fn');
@@ -4219,7 +4193,7 @@ exports.inverse = function(p) {
 };
 exports.names = ["Transverse_Mercator", "Transverse Mercator", "tmerc"];
 
-},{"../common/adjust_lon":5,"../common/asinz":6,"../common/e0fn":7,"../common/e1fn":8,"../common/e2fn":9,"../common/e3fn":10,"../common/mlfn":14,"../common/sign":21}],63:[function(_dereq_,module,exports){
+},{"../common/adjust_lon":5,"../common/asinz":6,"../common/e0fn":7,"../common/e1fn":8,"../common/e2fn":9,"../common/e3fn":10,"../common/mlfn":14,"../common/sign":21}],62:[function(_dereq_,module,exports){
 var D2R = 0.01745329251994329577;
 var tmerc = _dereq_('./tmerc');
 exports.dependsOn = 'tmerc';
@@ -4239,7 +4213,7 @@ exports.init = function() {
 };
 exports.names = ["Universal Transverse Mercator System", "utm"];
 
-},{"./tmerc":62}],64:[function(_dereq_,module,exports){
+},{"./tmerc":61}],63:[function(_dereq_,module,exports){
 var adjust_lon = _dereq_('../common/adjust_lon');
 var HALF_PI = Math.PI/2;
 var EPSLN = 1.0e-10;
@@ -4360,7 +4334,7 @@ exports.inverse = function(p) {
   return p;
 };
 exports.names = ["Van_der_Grinten_I", "VanDerGrinten", "vandg"];
-},{"../common/adjust_lon":5,"../common/asinz":6}],65:[function(_dereq_,module,exports){
+},{"../common/adjust_lon":5,"../common/asinz":6}],64:[function(_dereq_,module,exports){
 var D2R = 0.01745329251994329577;
 var R2D = 57.29577951308232088;
 var PJD_3PARAM = 1;
@@ -4433,7 +4407,7 @@ module.exports = function transform(source, dest, point) {
 
   return point;
 };
-},{"./Proj":2,"./adjust_axis":3,"./common/toPoint":23,"./datum_transform":31}],66:[function(_dereq_,module,exports){
+},{"./Proj":2,"./adjust_axis":3,"./common/toPoint":23,"./datum_transform":30}],65:[function(_dereq_,module,exports){
 var D2R = 0.01745329251994329577;
 var extend = _dereq_('./extend');
 
@@ -4613,7 +4587,6 @@ function cleanWKT(wkt) {
     ['false_northing', 'False_Northing'],
     ['central_meridian', 'Central_Meridian'],
     ['latitude_of_origin', 'Latitude_Of_Origin'],
-    ['latitude_of_origin', 'Central_Parallel'],
     ['scale_factor', 'Scale_Factor'],
     ['k0', 'scale_factor'],
     ['latitude_of_center', 'Latitude_of_center'],
@@ -4631,16 +4604,12 @@ function cleanWKT(wkt) {
     ['srsCode', 'name']
   ];
   list.forEach(renamer);
-  if (!wkt.long0 && wkt.longc && (wkt.projName === 'Albers_Conic_Equal_Area' || wkt.projName === "Lambert_Azimuthal_Equal_Area")) {
+  if (!wkt.long0 && wkt.longc && (wkt.PROJECTION === 'Albers_Conic_Equal_Area' || wkt.PROJECTION === "Lambert_Azimuthal_Equal_Area")) {
     wkt.long0 = wkt.longc;
   }
-  if (!wkt.lat_ts && wkt.lat1 && (wkt.projName === 'Stereographic_South_Pole' || wkt.projName === 'Polar Stereographic (variant B)')) {
-    wkt.lat0 = d2r(wkt.lat1 > 0 ? 90 : -90);
-    wkt.lat_ts = wkt.lat1;
-  }
 }
 module.exports = function(wkt, self) {
-  var lisp = JSON.parse(("," + wkt).replace(/\s*\,\s*([A-Z_0-9]+?)(\[)/g, ',["$1",').slice(1).replace(/\s*\,\s*([A-Z_0-9]+?)\]/g, ',"$1"]').replace(/,\["VERTCS".+/,''));
+  var lisp = JSON.parse(("," + wkt).replace(/\s*\,\s*([A-Z_0-9]+?)(\[)/g, ',["$1",').slice(1).replace(/\s*\,\s*([A-Z_0-9]+?)\]/g, ',"$1"]'));
   var type = lisp.shift();
   var name = lisp.shift();
   lisp.unshift(['name', name]);
@@ -4652,7 +4621,7 @@ module.exports = function(wkt, self) {
   return extend(self, obj.output);
 };
 
-},{"./extend":34}],67:[function(_dereq_,module,exports){
+},{"./extend":33}],66:[function(_dereq_,module,exports){
 
 
 
@@ -4692,7 +4661,7 @@ var Z = 90; // Z
  * @param {object} ll Object literal with lat and lon properties on a
  *     WGS84 ellipsoid.
  * @param {int} accuracy Accuracy in digits (5 for 1 m, 4 for 10 m, 3 for
- *      100 m, 2 for 1000 m or 1 for 10000 m). Optional, default is 5.
+ *      100 m, 4 for 1000 m or 5 for 10000 m). Optional, default is 5.
  * @return {string} the MGRS string for the given location and accuracy.
  */
 exports.forward = function(ll, accuracy) {
@@ -4713,18 +4682,12 @@ exports.forward = function(ll, accuracy) {
  */
 exports.inverse = function(mgrs) {
   var bbox = UTMtoLL(decode(mgrs.toUpperCase()));
-  if (bbox.lat && bbox.lon) {
-    return [bbox.lon, bbox.lat, bbox.lon, bbox.lat];
-  }
   return [bbox.left, bbox.bottom, bbox.right, bbox.top];
 };
 
-exports.toPoint = function(mgrs) {
-  var bbox = UTMtoLL(decode(mgrs.toUpperCase()));
-  if (bbox.lat && bbox.lon) {
-    return [bbox.lon, bbox.lat];
-  }
-  return [(bbox.left + bbox.right) / 2, (bbox.top + bbox.bottom) / 2];
+exports.toPoint = function(mgrsStr) {
+  var llbbox = exports.inverse(mgrsStr);
+  return [(llbbox[2] + llbbox[0]) / 2, (llbbox[3] + llbbox[1]) / 2];
 };
 /**
  * Conversion from degrees to radians.
@@ -5014,9 +4977,8 @@ function getLetterDesignator(lat) {
  * @return {string} MGRS string for the given UTM location.
  */
 function encode(utm, accuracy) {
-  // prepend with leading zeroes
-  var seasting = "00000" + utm.easting,
-    snorthing = "00000" + utm.northing;
+  var seasting = "" + utm.easting,
+    snorthing = "" + utm.northing;
 
   return utm.zoneNumber + utm.zoneLetter + get100kID(utm.easting, utm.northing, utm.zoneNumber) + seasting.substr(seasting.length - 5, accuracy) + snorthing.substr(snorthing.length - 5, accuracy);
 }
@@ -5396,10 +5358,10 @@ function getMinNorthing(zoneLetter) {
 
 }
 
-},{}],68:[function(_dereq_,module,exports){
+},{}],67:[function(_dereq_,module,exports){
 module.exports={
   "name": "proj4",
-  "version": "2.3.10",
+  "version": "2.2.1",
   "description": "Proj4js is a JavaScript library to transform point coordinates from one coordinate system to another, including datum transformations.",
   "main": "lib/index.js",
   "directories": {
@@ -5440,13 +5402,12 @@ module.exports={
     "tin": "~0.4.0"
   },
   "dependencies": {
-    "mgrs": "~0.0.2"
+    "mgrs": "0.0.0"
   }
 }
-
 },{}],"./includedProjections":[function(_dereq_,module,exports){
-module.exports=_dereq_('hTEDpn');
-},{}],"hTEDpn":[function(_dereq_,module,exports){
+module.exports=_dereq_('gWUPNW');
+},{}],"gWUPNW":[function(_dereq_,module,exports){
 var projs = [
  _dereq_('./lib/projections/tmerc'),
 	_dereq_('./lib/projections/utm'),
@@ -5476,6 +5437,6 @@ module.exports = function(proj4){
    proj4.Proj.projections.add(proj);
  });
 }
-},{"./lib/projections/aea":40,"./lib/projections/aeqd":41,"./lib/projections/cass":42,"./lib/projections/cea":43,"./lib/projections/eqc":44,"./lib/projections/eqdc":45,"./lib/projections/gnom":47,"./lib/projections/krovak":48,"./lib/projections/laea":49,"./lib/projections/lcc":50,"./lib/projections/mill":53,"./lib/projections/moll":54,"./lib/projections/nzmg":55,"./lib/projections/omerc":56,"./lib/projections/poly":57,"./lib/projections/sinu":58,"./lib/projections/somerc":59,"./lib/proje [...]
-(36)
+},{"./lib/projections/aea":39,"./lib/projections/aeqd":40,"./lib/projections/cass":41,"./lib/projections/cea":42,"./lib/projections/eqc":43,"./lib/projections/eqdc":44,"./lib/projections/gnom":46,"./lib/projections/krovak":47,"./lib/projections/laea":48,"./lib/projections/lcc":49,"./lib/projections/mill":52,"./lib/projections/moll":53,"./lib/projections/nzmg":54,"./lib/projections/omerc":55,"./lib/projections/poly":56,"./lib/projections/sinu":57,"./lib/projections/somerc":58,"./lib/proje [...]
+(35)
 });
\ No newline at end of file
diff --git a/lib/datum.js b/lib/datum.js
index 916e7c5..e7c6fbc 100644
--- a/lib/datum.js
+++ b/lib/datum.js
@@ -18,23 +18,23 @@ var datum = function(proj) {
   if (proj.datumCode && proj.datumCode === 'none') {
     this.datum_type = PJD_NODATUM;
   }
+
   if (proj.datum_params) {
-    for (var i = 0; i < proj.datum_params.length; i++) {
-      proj.datum_params[i] = parseFloat(proj.datum_params[i]);
-    }
-    if (proj.datum_params[0] !== 0 || proj.datum_params[1] !== 0 || proj.datum_params[2] !== 0) {
+    this.datum_params = proj.datum_params.map(parseFloat); 
+    if (this.datum_params[0] !== 0 || this.datum_params[1] !== 0 || this.datum_params[2] !== 0) {
       this.datum_type = PJD_3PARAM;
     }
-    if (proj.datum_params.length > 3) {
-      if (proj.datum_params[3] !== 0 || proj.datum_params[4] !== 0 || proj.datum_params[5] !== 0 || proj.datum_params[6] !== 0) {
+    if (this.datum_params.length > 3) {
+      if (this.datum_params[3] !== 0 || this.datum_params[4] !== 0 || this.datum_params[5] !== 0 || this.datum_params[6] !== 0) {
         this.datum_type = PJD_7PARAM;
-        proj.datum_params[3] *= SEC_TO_RAD;
-        proj.datum_params[4] *= SEC_TO_RAD;
-        proj.datum_params[5] *= SEC_TO_RAD;
-        proj.datum_params[6] = (proj.datum_params[6] / 1000000.0) + 1.0;
+        this.datum_params[3] *= SEC_TO_RAD;
+        this.datum_params[4] *= SEC_TO_RAD;
+        this.datum_params[5] *= SEC_TO_RAD;
+        this.datum_params[6] = (this.datum_params[6] / 1000000.0) + 1.0;
       }
     }
   }
+  
   // DGR 2011-03-21 : nadgrids support
   this.datum_type = proj.grids ? PJD_GRIDSHIFT : this.datum_type;
 
@@ -42,7 +42,6 @@ var datum = function(proj) {
   this.b = proj.b;
   this.es = proj.es;
   this.ep2 = proj.ep2;
-  this.datum_params = proj.datum_params;
   if (this.datum_type === PJD_GRIDSHIFT) {
     this.grids = proj.grids;
   }
diff --git a/lib/wkt.js b/lib/wkt.js
index f759770..8e8803b 100644
--- a/lib/wkt.js
+++ b/lib/wkt.js
@@ -111,7 +111,13 @@ function cleanWKT(wkt) {
       wkt.units = 'meter';
     }
     if (wkt.UNIT.convert) {
-      wkt.to_meter = parseFloat(wkt.UNIT.convert, 10);
+      if (wkt.type === 'GEOGCS') {
+        if (wkt.DATUM && wkt.DATUM.SPHEROID) {
+          wkt.to_meter = parseFloat(wkt.UNIT.convert, 10)*wkt.DATUM.SPHEROID.a;
+        }
+      } else {
+        wkt.to_meter = parseFloat(wkt.UNIT.convert, 10);
+      }
     }
   }
 
diff --git a/package.json b/package.json
index 8fc17d2..3ee40c4 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
 {
   "name": "proj4",
-  "version": "2.3.10-alpha",
+  "version": "2.3.11-alpha",
   "description": "Proj4js is a JavaScript library to transform point coordinates from one coordinate system to another, including datum transformations.",
   "main": "lib/index.js",
   "directories": {
diff --git a/test/test.js b/test/test.js
index c9c8653..45bfc32 100644
--- a/test/test.js
+++ b/test/test.js
@@ -171,6 +171,16 @@ function startTests(chai, proj4, testPoints) {
       assert.typeOf(proj4.defs['foo'], 'object');
       proj4.defs('urn:x-ogc:def:crs:EPSG:4326', proj4.defs('EPSG:4326'));
       assert.strictEqual(proj4.defs['urn:x-ogc:def:crs:EPSG:4326'], proj4.defs['EPSG:4326']);
+
+      describe('wkt', function() {
+        it('should provide the correct conversion factor for WKT GEOGCS projections', function() {
+          proj4.defs('EPSG:4269', 'GEOGCS["NAD83",DATUM["North_American_Datum_1983",SPHEROID["GRS 1980",6378137,298.257222101,AUTHORITY["EPSG","7019"]],AUTHORITY["EPSG","6269"]],PRIMEM["Greenwich",0,AUTHORITY["EPSG","8901"]],UNIT["degree",0.01745329251994328,AUTHORITY["EPSG","9122"]],AUTHORITY["EPSG","4269"]]');
+          assert.equal(proj4.defs['EPSG:4269'].to_meter, 6378137*0.01745329251994328);
+
+          proj4.defs('EPSG:4279', 'GEOGCS["OS(SN)80",DATUM["OS_SN_1980",SPHEROID["Airy 1830",6377563.396,299.3249646,AUTHORITY["EPSG","7001"]],AUTHORITY["EPSG","6279"]],PRIMEM["Greenwich",0,AUTHORITY["EPSG","8901"]],UNIT["degree",0.01745329251994328,AUTHORITY["EPSG","9122"]],AUTHORITY["EPSG","4279"]]');
+          assert.equal(proj4.defs['EPSG:4279'].to_meter, 6377563.396*0.01745329251994328);
+        }); 
+      });
     });
     describe('errors', function() {
       it('should throw an error for an unknown ref', function() {

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-grass/proj4js.git



More information about the Pkg-grass-devel mailing list