Loading lib/proj4js.js +33 −33 Original line number Diff line number Diff line Loading @@ -165,12 +165,14 @@ var Proj4js = { if( fallback == Proj4js.common.PJD_GRIDSHIFT ) { if (this.apply_gridshift( source, 0, point )==0) { src_a = Proj4js.common.SRS_WGS84_SEMIMAJOR; src_es = Proj4js.common.SRS_WGS84_ESQUARED; source.a = Proj4js.common.SRS_WGS84_SEMIMAJOR; source.es = Proj4js.common.SRS_WGS84_ESQUARED; } else { // try 3 or 7 params transformation or nothing ? if (!source.datum_params) { source.a = src_a; source.es = source.es; return point; } var wp= 1.0; Loading @@ -178,6 +180,8 @@ var Proj4js = { wp*= source.datum_params[i]; } if (wp==0.0) { source.a = src_a; source.es = source.es; return point; } fallback= source.datum_params.length>3? Loading @@ -189,11 +193,11 @@ var Proj4js = { if( dest.datum_type == Proj4js.common.PJD_GRIDSHIFT ) { dst_a = Proj4js.common.SRS_WGS84_SEMIMAJOR; dst_es = Proj4js.common.SRS_WGS84_ESQUARED; dest.a = Proj4js.common.SRS_WGS84_SEMIMAJOR; dest.es = Proj4js.common.SRS_WGS84_ESQUARED; } // Do we need to go through geocentric coordinates? if( src_es != dst_es || src_a != dst_a if (source.es != dest.es || source.a != dest.a || fallback == Proj4js.common.PJD_3PARAM || fallback == Proj4js.common.PJD_7PARAM || dest.datum_type == Proj4js.common.PJD_3PARAM Loading Loading @@ -228,6 +232,11 @@ var Proj4js = { // CHECK_RETURN; } source.a = src_a; source.es = src_es; dest.a = dst_a; dest.es = dst_es; return point; }, // cs_datum_transform Loading Loading @@ -1063,9 +1072,6 @@ Proj4js.Proj = Proj4js.Class({ this.nadgrids= null; } if (this.nadgrids) { if (this.nadgrids == '@null' && !this.datum_params) { this.datumCode = 'none'; } else { this.grids= this.nadgrids.split(","); var g= null; for (var i= 0, l= this.grids.length; i<l; i++) { Loading @@ -1080,7 +1086,6 @@ Proj4js.Proj = Proj4js.Class({ Proj4js.reportError("Missing '"+this.grids[i].name+"'"); } } } // DGR, 2011-03-20: grids is an array of objects that hold // the loaded grids, its name and the mandatory informations of it. } Loading Loading @@ -1155,7 +1160,7 @@ Proj4js.defs = { 'WGS84': "+title=WGS 84 (long/lat) +proj=longlat +ellps=WGS84 +datum=WGS84 +units=degrees", 'EPSG:4326': "+title=WGS 84 (long/lat) +proj=longlat +ellps=WGS84 +datum=WGS84 +units=degrees", 'EPSG:4269': "+title=NAD83 (long/lat) +proj=longlat +a=6378137.0 +b=6356752.31414036 +ellps=GRS80 +datum=NAD83 +units=degrees", 'EPSG:3857': "+title=Google Mercator +proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y_0=0 +k=1.0 +units=m +nadgrids=@null +no_defs" 'EPSG:3857': "+title=WGS 84 / Pseudo-Mercator +proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y_0=0 +k=1.0 +units=m +nadgrids=@null +no_defs" }; Proj4js.defs['EPSG:3785'] = Proj4js.defs['EPSG:3857']; //maintain backward compat, official code is 3857 Proj4js.defs['GOOGLE'] = Proj4js.defs['EPSG:3857']; Loading Loading @@ -1184,7 +1189,7 @@ Proj4js.common = { PJD_WGS84 : 4, // WGS84 or equivalent PJD_NODATUM : 5, // WGS84 or equivalent SRS_WGS84_SEMIMAJOR : 6378137.0, // only used in grid shift transforms SRS_WGS84_ESQUARED : 0.0066943799901413165, //DGR: 2012-07-29 SRS_WGS84_ESQUARED : 0.006694379990141316, //DGR: 2012-07-29 // ellipoid pj_set_ell.c SIXTH : .1666666666666666667, /* 1/6 */ Loading Loading @@ -1242,8 +1247,8 @@ Proj4js.common = { } }, /** Function to compute the inverse of qsfnz */ /* Function to compute the inverse of qsfnz ------------------------------------------------------------*/ iqsfnz : function (eccent, q) { var temp = 1.0-(1.0-eccent*eccent)/(2.0*eccent)*Math.log((1-eccent)/(1+eccent)); if (Math.abs(Math.abs(q)-temp)<1.0E-6) { Loading Loading @@ -1284,11 +1289,6 @@ Proj4js.common = { }, // following functions from gctpc cproj.c for transverse mercator projections e0fn : function(x) {return(1.0-0.25*x*(1.0+x/16.0*(3.0+1.25*x)));}, e1fn : function(x) {return(0.375*x*(1.0+0.25*x*(1.0+0.46875*x)));}, e2fn : function(x) {return(0.05859375*x*x*(1.0+0.75*x));}, e3fn : function(x) {return(x*x*x*(35.0/3072.0));}, mlfn : function(e0,e1,e2,e3,phi) {return(e0*phi-e1*Math.sin(2.0*phi)+e2*Math.sin(4.0*phi)-e3*Math.sin(6.0*phi));}, e0fn : function(x) {return(1.0-0.25*x*(1.0+x/16.0*(3.0+1.25*x)));}, e1fn : function(x) {return(0.375*x*(1.0+0.25*x*(1.0+0.46875*x)));}, e2fn : function(x) {return(0.05859375*x*x*(1.0+0.75*x));}, Loading Loading @@ -1354,7 +1354,7 @@ Proj4js.common = { do { Iphi= phi; con= eccent*Math.sin(Iphi); phi= this.fL(Math.exp(eccent*Math.log((1.0+con)/(1.0-con))/2.0),ts) phi= this.fL(Math.exp(eccent*Math.log((1.0+con)/(1.0-con))/2.0),ts); } while (Math.abs(phi-Iphi)>1.0e-12); return phi; }, Loading Loading
lib/proj4js.js +33 −33 Original line number Diff line number Diff line Loading @@ -165,12 +165,14 @@ var Proj4js = { if( fallback == Proj4js.common.PJD_GRIDSHIFT ) { if (this.apply_gridshift( source, 0, point )==0) { src_a = Proj4js.common.SRS_WGS84_SEMIMAJOR; src_es = Proj4js.common.SRS_WGS84_ESQUARED; source.a = Proj4js.common.SRS_WGS84_SEMIMAJOR; source.es = Proj4js.common.SRS_WGS84_ESQUARED; } else { // try 3 or 7 params transformation or nothing ? if (!source.datum_params) { source.a = src_a; source.es = source.es; return point; } var wp= 1.0; Loading @@ -178,6 +180,8 @@ var Proj4js = { wp*= source.datum_params[i]; } if (wp==0.0) { source.a = src_a; source.es = source.es; return point; } fallback= source.datum_params.length>3? Loading @@ -189,11 +193,11 @@ var Proj4js = { if( dest.datum_type == Proj4js.common.PJD_GRIDSHIFT ) { dst_a = Proj4js.common.SRS_WGS84_SEMIMAJOR; dst_es = Proj4js.common.SRS_WGS84_ESQUARED; dest.a = Proj4js.common.SRS_WGS84_SEMIMAJOR; dest.es = Proj4js.common.SRS_WGS84_ESQUARED; } // Do we need to go through geocentric coordinates? if( src_es != dst_es || src_a != dst_a if (source.es != dest.es || source.a != dest.a || fallback == Proj4js.common.PJD_3PARAM || fallback == Proj4js.common.PJD_7PARAM || dest.datum_type == Proj4js.common.PJD_3PARAM Loading Loading @@ -228,6 +232,11 @@ var Proj4js = { // CHECK_RETURN; } source.a = src_a; source.es = src_es; dest.a = dst_a; dest.es = dst_es; return point; }, // cs_datum_transform Loading Loading @@ -1063,9 +1072,6 @@ Proj4js.Proj = Proj4js.Class({ this.nadgrids= null; } if (this.nadgrids) { if (this.nadgrids == '@null' && !this.datum_params) { this.datumCode = 'none'; } else { this.grids= this.nadgrids.split(","); var g= null; for (var i= 0, l= this.grids.length; i<l; i++) { Loading @@ -1080,7 +1086,6 @@ Proj4js.Proj = Proj4js.Class({ Proj4js.reportError("Missing '"+this.grids[i].name+"'"); } } } // DGR, 2011-03-20: grids is an array of objects that hold // the loaded grids, its name and the mandatory informations of it. } Loading Loading @@ -1155,7 +1160,7 @@ Proj4js.defs = { 'WGS84': "+title=WGS 84 (long/lat) +proj=longlat +ellps=WGS84 +datum=WGS84 +units=degrees", 'EPSG:4326': "+title=WGS 84 (long/lat) +proj=longlat +ellps=WGS84 +datum=WGS84 +units=degrees", 'EPSG:4269': "+title=NAD83 (long/lat) +proj=longlat +a=6378137.0 +b=6356752.31414036 +ellps=GRS80 +datum=NAD83 +units=degrees", 'EPSG:3857': "+title=Google Mercator +proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y_0=0 +k=1.0 +units=m +nadgrids=@null +no_defs" 'EPSG:3857': "+title=WGS 84 / Pseudo-Mercator +proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y_0=0 +k=1.0 +units=m +nadgrids=@null +no_defs" }; Proj4js.defs['EPSG:3785'] = Proj4js.defs['EPSG:3857']; //maintain backward compat, official code is 3857 Proj4js.defs['GOOGLE'] = Proj4js.defs['EPSG:3857']; Loading Loading @@ -1184,7 +1189,7 @@ Proj4js.common = { PJD_WGS84 : 4, // WGS84 or equivalent PJD_NODATUM : 5, // WGS84 or equivalent SRS_WGS84_SEMIMAJOR : 6378137.0, // only used in grid shift transforms SRS_WGS84_ESQUARED : 0.0066943799901413165, //DGR: 2012-07-29 SRS_WGS84_ESQUARED : 0.006694379990141316, //DGR: 2012-07-29 // ellipoid pj_set_ell.c SIXTH : .1666666666666666667, /* 1/6 */ Loading Loading @@ -1242,8 +1247,8 @@ Proj4js.common = { } }, /** Function to compute the inverse of qsfnz */ /* Function to compute the inverse of qsfnz ------------------------------------------------------------*/ iqsfnz : function (eccent, q) { var temp = 1.0-(1.0-eccent*eccent)/(2.0*eccent)*Math.log((1-eccent)/(1+eccent)); if (Math.abs(Math.abs(q)-temp)<1.0E-6) { Loading Loading @@ -1284,11 +1289,6 @@ Proj4js.common = { }, // following functions from gctpc cproj.c for transverse mercator projections e0fn : function(x) {return(1.0-0.25*x*(1.0+x/16.0*(3.0+1.25*x)));}, e1fn : function(x) {return(0.375*x*(1.0+0.25*x*(1.0+0.46875*x)));}, e2fn : function(x) {return(0.05859375*x*x*(1.0+0.75*x));}, e3fn : function(x) {return(x*x*x*(35.0/3072.0));}, mlfn : function(e0,e1,e2,e3,phi) {return(e0*phi-e1*Math.sin(2.0*phi)+e2*Math.sin(4.0*phi)-e3*Math.sin(6.0*phi));}, e0fn : function(x) {return(1.0-0.25*x*(1.0+x/16.0*(3.0+1.25*x)));}, e1fn : function(x) {return(0.375*x*(1.0+0.25*x*(1.0+0.46875*x)));}, e2fn : function(x) {return(0.05859375*x*x*(1.0+0.75*x));}, Loading Loading @@ -1354,7 +1354,7 @@ Proj4js.common = { do { Iphi= phi; con= eccent*Math.sin(Iphi); phi= this.fL(Math.exp(eccent*Math.log((1.0+con)/(1.0-con))/2.0),ts) phi= this.fL(Math.exp(eccent*Math.log((1.0+con)/(1.0-con))/2.0),ts); } while (Math.abs(phi-Iphi)>1.0e-12); return phi; }, Loading