Loading src/projCode/aea.js +140 −140 Original line number Diff line number Diff line Loading @@ -53,7 +53,8 @@ proj4.Proj.aea = { if (Math.abs(this.lat1 - this.lat2) > proj4.common.EPSLN) { this.ns0 = (this.ms1 * this.ms1 - this.ms2 * this.ms2) / (this.qs2 - this.qs1); } else { } else { this.ns0 = this.con; } this.c = this.ms1 * this.ms1 + this.ns0 * this.qs1; Loading Loading @@ -90,7 +91,8 @@ proj4.Proj.aea = { if (this.ns0 >= 0) { rh1 = Math.sqrt(p.x * p.x + p.y * p.y); con = 1.0; } else { } else { rh1 = -Math.sqrt(p.x * p.x + p.y * p.y); con = -1.0; } Loading @@ -101,7 +103,8 @@ proj4.Proj.aea = { con = rh1 * this.ns0 / this.a; if (this.sphere) { lat = Math.asin((this.c - con * con) / (2.0 * this.ns0)); } else { } else { qs = (this.c - con * con) / this.ns0; lat = this.phi1z(this.e3, qs); } Loading Loading @@ -135,6 +138,3 @@ proj4.Proj.aea = { } }; src/projCode/aeqd.js +185 −173 Original line number Diff line number Diff line Loading @@ -18,12 +18,14 @@ proj4.Proj.aeqd = { p.x = this.x0 + this.a * (proj4.common.HALF_PI - lat) * Math.sin(dlon); p.y = this.y0 - this.a * (proj4.common.HALF_PI - lat) * Math.cos(dlon); return p; } else if (Math.abs(this.sin_p12+1.0)<=proj4.common.EPSLN){ } else if (Math.abs(this.sin_p12 + 1.0) <= proj4.common.EPSLN) { //South Pole case p.x = this.x0 + this.a * (proj4.common.HALF_PI + lat) * Math.sin(dlon); p.y = this.y0 + this.a * (proj4.common.HALF_PI + lat) * Math.cos(dlon); return p; } else { } else { //default case var cos_c = this.sin_p12 * sinphi + this.cos_p12 * cosphi * Math.cos(dlon); var c = Math.acos(cos_c); Loading @@ -32,7 +34,8 @@ proj4.Proj.aeqd = { p.y = this.y0 + this.a * kp * (this.cos_p12 * sinphi - this.sin_p12 * cosphi * Math.cos(dlon)); return p; } } else { } else { var e0 = proj4.common.e0fn(this.es); var e1 = proj4.common.e1fn(this.es); var e2 = proj4.common.e2fn(this.es); Loading @@ -44,14 +47,16 @@ proj4.Proj.aeqd = { p.x = this.x0 + (Mlp - Ml) * Math.sin(dlon); p.y = this.y0 - (Mlp - Ml) * Math.cos(dlon); return p; } else if (Math.abs(this.sin_p12+1.0)<=proj4.common.EPSLN){ } else if (Math.abs(this.sin_p12 + 1.0) <= proj4.common.EPSLN) { //South Pole case var Mlp = this.a * proj4.common.mlfn(e0, e1, e2, e3, proj4.common.HALF_PI); var Ml = this.a * proj4.common.mlfn(e0, e1, e2, e3, lat); p.x = this.x0 + (Mlp + Ml) * Math.sin(dlon); p.y = this.y0 + (Mlp + Ml) * Math.cos(dlon); return p; } else { } else { //Default case var tanphi = sinphi / cosphi; var Nl1 = proj4.common.gN(this.a, this.e, this.sin_p12); Loading @@ -61,9 +66,11 @@ proj4.Proj.aeqd = { var s; if (Az == 0) { s = Math.asin(this.cos_p12 * Math.sin(psi) - this.sin_p12 * Math.cos(psi)); } else if (Math.abs(Math.abs(Az)-proj4.common.PI)<=proj4.common.EPSLN){ } else if (Math.abs(Math.abs(Az) - proj4.common.PI) <= proj4.common.EPSLN) { s = -Math.asin(this.cos_p12 * Math.sin(psi) - this.sin_p12 * Math.cos(psi)); } else { } else { s = Math.asin(Math.sin(dlon) * Math.cos(psi) / Math.sin(Az)); } var G = this.e * this.sin_p12 / Math.sqrt(1.0 - this.es); Loading Loading @@ -97,16 +104,19 @@ proj4.Proj.aeqd = { var lat; if (Math.abs(rh) <= proj4.common.EPSLN) { lat = this.lat0; } else { } else { lat = proj4.common.asinz(cosz * this.sin_p12 + (p.y * sinz * this.cos_p12) / rh); var con = Math.abs(this.lat0) - proj4.common.HALF_PI; if (Math.abs(con) <= proj4.common.EPSLN) { if (this.lat0 >= 0.0) { lon = proj4.common.adjust_lon(this.long0 + Math.atan2(p.x, - p.y)); } else { } else { lon = proj4.common.adjust_lon(this.long0 - Math.atan2(-p.x, p.y)); } } else { } else { /*con = cosz - this.sin_p12 * Math.sin(lat); if ((Math.abs(con) < proj4.common.EPSLN) && (Math.abs(p.x) < proj4.common.EPSLN)) { //no-op, just keep the lon value as is Loading Loading @@ -137,7 +147,8 @@ proj4.Proj.aeqd = { p.x = lon, p.y = lat; return p; } else if (Math.abs(this.sin_p12+1.0)<=proj4.common.EPSLN){ } else if (Math.abs(this.sin_p12 + 1.0) <= proj4.common.EPSLN) { //South pole case var Mlp = this.a * proj4.common.mlfn(e0, e1, e2, e3, proj4.common.HALF_PI); var rh = Math.sqrt(p.x * p.x + p.y * p.y); Loading @@ -148,7 +159,8 @@ proj4.Proj.aeqd = { p.x = lon, p.y = lat; return p; } else { } else { //default case var rh = Math.sqrt(p.x * p.x + p.y * p.y); var Az = Math.atan2(p.x, p.y); Loading src/projCode/cass.js +54 −50 Original line number Diff line number Diff line Loading @@ -51,7 +51,8 @@ proj4.Proj.cass = { if (this.sphere) { x = this.a * Math.asin(Math.cos(phi) * Math.sin(lam)); y = this.a * (Math.atan2(Math.tan(phi), Math.cos(lam)) - this.lat0); } else { } else { //ellipsoid var sinphi = Math.sin(phi); var cosphi = Math.cos(phi); Loading Loading @@ -86,14 +87,17 @@ proj4.Proj.cass = { var dd = y + this.lat0; phi = Math.asin(Math.sin(dd) * Math.cos(x)); lam = Math.atan2(Math.tan(x), Math.cos(dd)); } else { } else { /* ellipsoid */ var ml1 = this.ml0 / this.a + y; var phi1 = proj4.common.imlfn(ml1, this.e0, this.e1, this.e2, this.e3); if (Math.abs(Math.abs(phi1) - proj4.common.HALF_PI) <= proj4.common.EPSLN) { p.x = this.long0; p.y = proj4.common.HALF_PI; if (y<0.0){p.y*=-1.0;} if (y < 0.0) { p.y *= -1.0; } return p; } var nl1 = proj4.common.gN(this.a, this.e, Math.sin(phi1)); Loading src/projCode/cea.js +92 −90 Original line number Diff line number Diff line Loading @@ -57,7 +57,8 @@ proj4.Proj.cea = { if (this.sphere) { x = this.x0 + this.a * dlon * Math.cos(this.lat_ts); y = this.y0 + this.a * Math.sin(lat) / Math.cos(this.lat_ts); } else { } else { var qs = proj4.common.qsfnz(this.e, Math.sin(lat)); x = this.x0 + this.a * this.k0 * dlon; y = this.y0 + this.a * qs * 0.5 / this.k0; Loading @@ -78,7 +79,8 @@ proj4.Proj.cea = { if (this.sphere) { lon = proj4.common.adjust_lon(this.long0 + (p.x / this.a) / Math.cos(this.lat_ts)); lat = Math.asin((p.y / this.a) * Math.cos(this.lat_ts)); } else { } else { lat = proj4.common.iqsfnz(this.e, 2.0 * p.y * this.k0 / this.a); lon = proj4.common.adjust_lon(this.long0 + p.x / (this.a * this.k0)); } Loading src/projCode/eqdc.js +137 −131 Original line number Diff line number Diff line Loading @@ -57,7 +57,8 @@ proj4.Proj.eqdc = { if (Math.abs(this.lat1 - this.lat2) < proj4.common.EPSLN) { this.ns = this.sinphi; proj4.reportError("eqdc:Init:EqualLatitudes"); } else { } else { this.sinphi = Math.sin(this.lat2); this.cosphi = Math.cos(this.lat2); this.ms2 = proj4.common.msfnz(this.e, this.sinphi, this.cosphi); Loading @@ -81,7 +82,8 @@ proj4.Proj.eqdc = { -----------------*/ if (this.sphere) { rh1 = this.a * (this.g - lat); } else { } else { var ml = proj4.common.mlfn(this.e0, this.e1, this.e2, this.e3, lat); rh1 = this.a * (this.g - ml); } Loading @@ -102,12 +104,15 @@ proj4.Proj.eqdc = { if (this.ns >= 0) { rh1 = Math.sqrt(p.x * p.x + p.y * p.y); con = 1.0; } else { } else { rh1 = -Math.sqrt(p.x * p.x + p.y * p.y); con = -1.0; } var theta = 0.0; if (rh1 != 0.0) {theta = Math.atan2(con *p.x, con *p.y);} if (rh1 != 0.0) { theta = Math.atan2(con * p.x, con * p.y); } if (this.sphere) { lon = proj4.common.adjust_lon(this.long0 + theta / this.ns); Loading @@ -115,7 +120,8 @@ proj4.Proj.eqdc = { p.x = lon; p.y = lat; return p; } else { } else { var ml = this.g - rh1 / this.a; lat = proj4.common.imlfn(ml, this.e0, this.e1, this.e2, this.e3); lon = proj4.common.adjust_lon(this.long0 + theta / this.ns); Loading Loading
src/projCode/aea.js +140 −140 Original line number Diff line number Diff line Loading @@ -53,7 +53,8 @@ proj4.Proj.aea = { if (Math.abs(this.lat1 - this.lat2) > proj4.common.EPSLN) { this.ns0 = (this.ms1 * this.ms1 - this.ms2 * this.ms2) / (this.qs2 - this.qs1); } else { } else { this.ns0 = this.con; } this.c = this.ms1 * this.ms1 + this.ns0 * this.qs1; Loading Loading @@ -90,7 +91,8 @@ proj4.Proj.aea = { if (this.ns0 >= 0) { rh1 = Math.sqrt(p.x * p.x + p.y * p.y); con = 1.0; } else { } else { rh1 = -Math.sqrt(p.x * p.x + p.y * p.y); con = -1.0; } Loading @@ -101,7 +103,8 @@ proj4.Proj.aea = { con = rh1 * this.ns0 / this.a; if (this.sphere) { lat = Math.asin((this.c - con * con) / (2.0 * this.ns0)); } else { } else { qs = (this.c - con * con) / this.ns0; lat = this.phi1z(this.e3, qs); } Loading Loading @@ -135,6 +138,3 @@ proj4.Proj.aea = { } };
src/projCode/aeqd.js +185 −173 Original line number Diff line number Diff line Loading @@ -18,12 +18,14 @@ proj4.Proj.aeqd = { p.x = this.x0 + this.a * (proj4.common.HALF_PI - lat) * Math.sin(dlon); p.y = this.y0 - this.a * (proj4.common.HALF_PI - lat) * Math.cos(dlon); return p; } else if (Math.abs(this.sin_p12+1.0)<=proj4.common.EPSLN){ } else if (Math.abs(this.sin_p12 + 1.0) <= proj4.common.EPSLN) { //South Pole case p.x = this.x0 + this.a * (proj4.common.HALF_PI + lat) * Math.sin(dlon); p.y = this.y0 + this.a * (proj4.common.HALF_PI + lat) * Math.cos(dlon); return p; } else { } else { //default case var cos_c = this.sin_p12 * sinphi + this.cos_p12 * cosphi * Math.cos(dlon); var c = Math.acos(cos_c); Loading @@ -32,7 +34,8 @@ proj4.Proj.aeqd = { p.y = this.y0 + this.a * kp * (this.cos_p12 * sinphi - this.sin_p12 * cosphi * Math.cos(dlon)); return p; } } else { } else { var e0 = proj4.common.e0fn(this.es); var e1 = proj4.common.e1fn(this.es); var e2 = proj4.common.e2fn(this.es); Loading @@ -44,14 +47,16 @@ proj4.Proj.aeqd = { p.x = this.x0 + (Mlp - Ml) * Math.sin(dlon); p.y = this.y0 - (Mlp - Ml) * Math.cos(dlon); return p; } else if (Math.abs(this.sin_p12+1.0)<=proj4.common.EPSLN){ } else if (Math.abs(this.sin_p12 + 1.0) <= proj4.common.EPSLN) { //South Pole case var Mlp = this.a * proj4.common.mlfn(e0, e1, e2, e3, proj4.common.HALF_PI); var Ml = this.a * proj4.common.mlfn(e0, e1, e2, e3, lat); p.x = this.x0 + (Mlp + Ml) * Math.sin(dlon); p.y = this.y0 + (Mlp + Ml) * Math.cos(dlon); return p; } else { } else { //Default case var tanphi = sinphi / cosphi; var Nl1 = proj4.common.gN(this.a, this.e, this.sin_p12); Loading @@ -61,9 +66,11 @@ proj4.Proj.aeqd = { var s; if (Az == 0) { s = Math.asin(this.cos_p12 * Math.sin(psi) - this.sin_p12 * Math.cos(psi)); } else if (Math.abs(Math.abs(Az)-proj4.common.PI)<=proj4.common.EPSLN){ } else if (Math.abs(Math.abs(Az) - proj4.common.PI) <= proj4.common.EPSLN) { s = -Math.asin(this.cos_p12 * Math.sin(psi) - this.sin_p12 * Math.cos(psi)); } else { } else { s = Math.asin(Math.sin(dlon) * Math.cos(psi) / Math.sin(Az)); } var G = this.e * this.sin_p12 / Math.sqrt(1.0 - this.es); Loading Loading @@ -97,16 +104,19 @@ proj4.Proj.aeqd = { var lat; if (Math.abs(rh) <= proj4.common.EPSLN) { lat = this.lat0; } else { } else { lat = proj4.common.asinz(cosz * this.sin_p12 + (p.y * sinz * this.cos_p12) / rh); var con = Math.abs(this.lat0) - proj4.common.HALF_PI; if (Math.abs(con) <= proj4.common.EPSLN) { if (this.lat0 >= 0.0) { lon = proj4.common.adjust_lon(this.long0 + Math.atan2(p.x, - p.y)); } else { } else { lon = proj4.common.adjust_lon(this.long0 - Math.atan2(-p.x, p.y)); } } else { } else { /*con = cosz - this.sin_p12 * Math.sin(lat); if ((Math.abs(con) < proj4.common.EPSLN) && (Math.abs(p.x) < proj4.common.EPSLN)) { //no-op, just keep the lon value as is Loading Loading @@ -137,7 +147,8 @@ proj4.Proj.aeqd = { p.x = lon, p.y = lat; return p; } else if (Math.abs(this.sin_p12+1.0)<=proj4.common.EPSLN){ } else if (Math.abs(this.sin_p12 + 1.0) <= proj4.common.EPSLN) { //South pole case var Mlp = this.a * proj4.common.mlfn(e0, e1, e2, e3, proj4.common.HALF_PI); var rh = Math.sqrt(p.x * p.x + p.y * p.y); Loading @@ -148,7 +159,8 @@ proj4.Proj.aeqd = { p.x = lon, p.y = lat; return p; } else { } else { //default case var rh = Math.sqrt(p.x * p.x + p.y * p.y); var Az = Math.atan2(p.x, p.y); Loading
src/projCode/cass.js +54 −50 Original line number Diff line number Diff line Loading @@ -51,7 +51,8 @@ proj4.Proj.cass = { if (this.sphere) { x = this.a * Math.asin(Math.cos(phi) * Math.sin(lam)); y = this.a * (Math.atan2(Math.tan(phi), Math.cos(lam)) - this.lat0); } else { } else { //ellipsoid var sinphi = Math.sin(phi); var cosphi = Math.cos(phi); Loading Loading @@ -86,14 +87,17 @@ proj4.Proj.cass = { var dd = y + this.lat0; phi = Math.asin(Math.sin(dd) * Math.cos(x)); lam = Math.atan2(Math.tan(x), Math.cos(dd)); } else { } else { /* ellipsoid */ var ml1 = this.ml0 / this.a + y; var phi1 = proj4.common.imlfn(ml1, this.e0, this.e1, this.e2, this.e3); if (Math.abs(Math.abs(phi1) - proj4.common.HALF_PI) <= proj4.common.EPSLN) { p.x = this.long0; p.y = proj4.common.HALF_PI; if (y<0.0){p.y*=-1.0;} if (y < 0.0) { p.y *= -1.0; } return p; } var nl1 = proj4.common.gN(this.a, this.e, Math.sin(phi1)); Loading
src/projCode/cea.js +92 −90 Original line number Diff line number Diff line Loading @@ -57,7 +57,8 @@ proj4.Proj.cea = { if (this.sphere) { x = this.x0 + this.a * dlon * Math.cos(this.lat_ts); y = this.y0 + this.a * Math.sin(lat) / Math.cos(this.lat_ts); } else { } else { var qs = proj4.common.qsfnz(this.e, Math.sin(lat)); x = this.x0 + this.a * this.k0 * dlon; y = this.y0 + this.a * qs * 0.5 / this.k0; Loading @@ -78,7 +79,8 @@ proj4.Proj.cea = { if (this.sphere) { lon = proj4.common.adjust_lon(this.long0 + (p.x / this.a) / Math.cos(this.lat_ts)); lat = Math.asin((p.y / this.a) * Math.cos(this.lat_ts)); } else { } else { lat = proj4.common.iqsfnz(this.e, 2.0 * p.y * this.k0 / this.a); lon = proj4.common.adjust_lon(this.long0 + p.x / (this.a * this.k0)); } Loading
src/projCode/eqdc.js +137 −131 Original line number Diff line number Diff line Loading @@ -57,7 +57,8 @@ proj4.Proj.eqdc = { if (Math.abs(this.lat1 - this.lat2) < proj4.common.EPSLN) { this.ns = this.sinphi; proj4.reportError("eqdc:Init:EqualLatitudes"); } else { } else { this.sinphi = Math.sin(this.lat2); this.cosphi = Math.cos(this.lat2); this.ms2 = proj4.common.msfnz(this.e, this.sinphi, this.cosphi); Loading @@ -81,7 +82,8 @@ proj4.Proj.eqdc = { -----------------*/ if (this.sphere) { rh1 = this.a * (this.g - lat); } else { } else { var ml = proj4.common.mlfn(this.e0, this.e1, this.e2, this.e3, lat); rh1 = this.a * (this.g - ml); } Loading @@ -102,12 +104,15 @@ proj4.Proj.eqdc = { if (this.ns >= 0) { rh1 = Math.sqrt(p.x * p.x + p.y * p.y); con = 1.0; } else { } else { rh1 = -Math.sqrt(p.x * p.x + p.y * p.y); con = -1.0; } var theta = 0.0; if (rh1 != 0.0) {theta = Math.atan2(con *p.x, con *p.y);} if (rh1 != 0.0) { theta = Math.atan2(con * p.x, con * p.y); } if (this.sphere) { lon = proj4.common.adjust_lon(this.long0 + theta / this.ns); Loading @@ -115,7 +120,8 @@ proj4.Proj.eqdc = { p.x = lon; p.y = lat; return p; } else { } else { var ml = this.g - rh1 / this.a; lat = proj4.common.imlfn(ml, this.e0, this.e1, this.e2, this.e3); lon = proj4.common.adjust_lon(this.long0 + theta / this.ns); Loading