Loading src/Proj.js +599 −500 Original line number Diff line number Diff line /** * Class: proj4.Proj * Loading Loading @@ -80,36 +79,35 @@ proj4.Proj = proj4.Class({ } //check to see if this is a WKT string if ((srsCode.indexOf('GEOGCS') >= 0) || (srsCode.indexOf('GEOCCS') >= 0) || (srsCode.indexOf('PROJCS') >= 0) || (srsCode.indexOf('LOCAL_CS') >= 0)) { if ((srsCode.indexOf('GEOGCS') >= 0) || (srsCode.indexOf('GEOCCS') >= 0) || (srsCode.indexOf('PROJCS') >= 0) || (srsCode.indexOf('LOCAL_CS') >= 0)) { this.parseWKT(srsCode); this.deriveConstants(); //this.loadProjCode(this.projName); }else{ } else { // DGR 2008-08-03 : support urn and url if (srsCode.indexOf('urn:') === 0) { //urn:ORIGINATOR:def:crs:CODESPACE:VERSION:ID var urn = srsCode.split(':'); if ((urn[1] === 'ogc' || urn[1] =='x-ogc') && (urn[2] ==='def') && (urn[3] ==='crs')) { if ((urn[1] === 'ogc' || urn[1] === 'x-ogc') && (urn[2] === 'def') && (urn[3] === 'crs')) { srsCode = urn[4] + ':' + urn[urn.length - 1]; } } else if (srsCode.indexOf('http://') === 0) { } else if (srsCode.indexOf('http://') === 0) { //url#ID var url = srsCode.split('#'); if (url[0].match(/epsg.org/)) { // http://www.epsg.org/# srsCode = 'EPSG:' + url[1]; } else if (url[0].match(/RIG.xml/)) { } else if (url[0].match(/RIG.xml/)) { //http://librairies.ign.fr/geoportail/resources/RIG.xml# //http://interop.ign.fr/registers/ign/RIG.xml# srsCode = 'IGNF:' + url[1]; } else if (url[0].indexOf('/def/crs/')!=-1) { } else if (url[0].indexOf('/def/crs/') !== -1) { // http://www.opengis.net/def/crs/EPSG/0/code url = srsCode.split('/'); srsCode = url.pop(); //code Loading @@ -123,16 +121,19 @@ proj4.Proj = proj4.Class({ this.srsAuth = 'epsg'; this.srsProjNumber = this.srsCode.substring(5); // DGR 2007-11-20 : authority IGNF } else if (this.srsCode.indexOf("IGNF") === 0) { } else if (this.srsCode.indexOf("IGNF") === 0) { this.srsCode = this.srsCode; this.srsAuth = 'IGNF'; this.srsProjNumber = this.srsCode.substring(5); // DGR 2008-06-19 : pseudo-authority CRS for WMS } else if (this.srsCode.indexOf("CRS") === 0) { } else if (this.srsCode.indexOf("CRS") === 0) { this.srsCode = this.srsCode; this.srsAuth = 'CRS'; this.srsProjNumber = this.srsCode.substring(4); } else { } else { this.srsAuth = ''; this.srsProjNumber = this.srsCode; } Loading Loading @@ -169,14 +170,17 @@ proj4.Proj = proj4.Class({ wktRE: /^(\w+)\[(.*)\]$/, parseWKT: function(wkt) { var wktMatch = wkt.match(this.wktRE); if (!wktMatch) return; if (!wktMatch){ return; } var wktObject = wktMatch[1]; var wktContent = wktMatch[2]; var wktTemp = wktContent.split(","); var wktName; if (wktObject.toUpperCase() === "TOWGS84") { wktName = wktObject; //no name supplied for the TOWGS84 array } else { } else { wktName = wktTemp.shift(); } wktName = wktName.replace(/^\"/, ""); Loading @@ -196,14 +200,19 @@ proj4.Proj = proj4.Class({ for (var i = 0; i < wktTemp.length; ++i) { var token = wktTemp[i]; for (var j2 = 0; j2 < token.length; ++j2) { if (token.charAt(j2) === "[") ++bkCount; if (token.charAt(j2) === "]") --bkCount; if (token.charAt(j2) === "["){ ++bkCount; } if (token.charAt(j2) === "]"){ --bkCount; } } obj += token; if (bkCount === 0) { wktArray.push(obj); obj = ""; } else { } else { obj += ","; } } Loading @@ -219,7 +228,9 @@ proj4.Proj = proj4.Class({ case 'GEOGCS': this.projName = 'longlat'; this.geocsCode = wktName; if (!this.srsCode) this.srsCode = wktName; if (!this.srsCode){ this.srsCode = wktName; } break; case 'PROJCS': this.srsCode = wktName; Loading Loading @@ -282,21 +293,44 @@ proj4.Proj = proj4.Class({ name = wktName.toLowerCase(); value = wktArray.shift(); switch (value) { case 'EAST' : value= 'e'; break; case 'WEST' : value= 'w'; break; case 'NORTH': value= 'n'; break; case 'SOUTH': value= 's'; break; case 'UP' : value= 'u'; break; case 'DOWN' : value= 'd'; break; case 'EAST': value = 'e'; break; case 'WEST': value = 'w'; break; case 'NORTH': value = 'n'; break; case 'SOUTH': value = 's'; break; case 'UP': value = 'u'; break; case 'DOWN': value = 'd'; break; //case 'OTHER': default : value= ' '; break;//FIXME default: value = ' '; break; //FIXME } if (!this.axis) { this.axis = "enu"; } if (!this.axis) { this.axis= "enu"; } switch (name) { case 'x': this.axis= value + this.axis.substr(1,2); break; case 'y': this.axis= this.axis.substr(0,1) + value + this.axis.substr(2,1); break; case 'z': this.axis= this.axis.substr(0,2) + value ; break; default : break; case 'x': this.axis = value + this.axis.substr(1, 2); break; case 'y': this.axis = this.axis.substr(0, 1) + value + this.axis.substr(2, 1); break; case 'z': this.axis = this.axis.substr(0, 2) + value; break; default: break; } break; case 'MORE_HERE': Loading @@ -315,12 +349,7 @@ proj4.Proj = proj4.Class({ * */ parseDefs: function() { var re= new RegExp('(title|proj|units|datum|nadgrids|'+ 'ellps|a|b|rf|'+ 'lat_0|lat_1|lat_2|lat_ts|lon_0|lon_1|lon_2|alpha|lonc|'+ 'x_0|y_0|k_0|k|r_a|zone|south|'+ 'towgs84|to_meter|from_greenwich|pm|axis|czech|'+ 'wktext|no_rot|no_off|no_defs)'); var re = new RegExp('(title|proj|units|datum|nadgrids|' + 'ellps|a|b|rf|' + 'lat_0|lat_1|lat_2|lat_ts|lon_0|lon_1|lon_2|alpha|lonc|' + 'x_0|y_0|k_0|k|r_a|zone|south|' + 'towgs84|to_meter|from_greenwich|pm|axis|czech|' + 'wktext|no_rot|no_off|no_defs)'); this.defData = proj4.defs[this.srsCode]; var paramName, paramVal; if (!this.defData) { Loading @@ -334,65 +363,128 @@ proj4.Proj = proj4.Class({ paramVal = property[1]; switch (paramName.replace(/\s/gi, "")) { // trim out spaces case "": break; // throw away nameless parameter case "": break; // throw away nameless parameter // DGR 2012-10-13 : + in title (EPSG:2056: CH1903+ / LV95) case "title": this.title = paramVal; case "title": this.title = paramVal; while (!paramArray[prop + 1].match(re)) { this.title += '+' + paramArray[++prop]; } break; case "proj": this.projName = paramVal.replace(/\s/gi,""); break; case "units": this.units = paramVal.replace(/\s/gi,""); break; case "datum": this.datumCode = paramVal.replace(/\s/gi,""); break; case "proj": this.projName = paramVal.replace(/\s/gi, ""); break; case "units": this.units = paramVal.replace(/\s/gi, ""); break; case "datum": this.datumCode = paramVal.replace(/\s/gi, ""); break; // DGR 2011-03-20 : nagrids -> nadgrids case "nadgrids": this.nadgrids = paramVal.replace(/\s/gi,""); break;// DGR 2012-07-29 case "ellps": this.ellps = paramVal.replace(/\s/gi,""); break; case "a": this.a = parseFloat(paramVal); break; // semi-major radius case "b": this.b = parseFloat(paramVal); break; // semi-minor radius case "nadgrids": this.nadgrids = paramVal.replace(/\s/gi, ""); break; // DGR 2012-07-29 case "ellps": this.ellps = paramVal.replace(/\s/gi, ""); break; case "a": this.a = parseFloat(paramVal); break; // semi-major radius case "b": this.b = parseFloat(paramVal); break; // semi-minor radius // DGR 2007-11-20 case "rf": this.rf = parseFloat(paramVal); break; // inverse flattening rf= a/(a-b) case "lat_0": this.lat0 = paramVal*proj4.common.D2R; break; // phi0, central latitude case "lat_1": this.lat1 = paramVal*proj4.common.D2R; break; //standard parallel 1 case "lat_2": this.lat2 = paramVal*proj4.common.D2R; break; //standard parallel 2 case "lat_ts": this.lat_ts = paramVal*proj4.common.D2R; break; // used in merc and eqc case "lon_0": this.long0 = paramVal*proj4.common.D2R; break; // lam0, central longitude case "lon_1": this.long1 = paramVal*proj4.common.D2R; break; case "lon_2": this.long2 = paramVal*proj4.common.D2R; break; case "no_rot": this.no_rot = true; break; case "no_off": this.no_off = true; break; case "alpha": this.alpha = parseFloat(paramVal)*proj4.common.D2R; break; //for somerc projection case "lonc": this.longc = paramVal*proj4.common.D2R; break; //for somerc projection case "x_0": this.x0 = parseFloat(paramVal); break; // false easting case "y_0": this.y0 = parseFloat(paramVal); break; // false northing case "k_0": this.k0 = parseFloat(paramVal); break; // projection scale factor case "k": this.k0 = parseFloat(paramVal); break; // both forms returned case "r_a": this.R_A = true; break; // sphere--area of ellipsoid case "zone": this.zone = parseInt(paramVal,10); break; // UTM Zone case "south": this.utmSouth = true; break; // UTM north/south case "towgs84":this.datum_params = paramVal.split(","); break; case "to_meter": this.to_meter = parseFloat(paramVal); break; // cartesian scaling case "from_greenwich": this.from_greenwich = paramVal*proj4.common.D2R; break; case "czech": this.czech = true; break; case "rf": this.rf = parseFloat(paramVal); break; // inverse flattening rf= a/(a-b) case "lat_0": this.lat0 = paramVal * proj4.common.D2R; break; // phi0, central latitude case "lat_1": this.lat1 = paramVal * proj4.common.D2R; break; //standard parallel 1 case "lat_2": this.lat2 = paramVal * proj4.common.D2R; break; //standard parallel 2 case "lat_ts": this.lat_ts = paramVal * proj4.common.D2R; break; // used in merc and eqc case "lon_0": this.long0 = paramVal * proj4.common.D2R; break; // lam0, central longitude case "lon_1": this.long1 = paramVal * proj4.common.D2R; break; case "lon_2": this.long2 = paramVal * proj4.common.D2R; break; case "no_rot": this.no_rot = true; break; case "no_off": this.no_off = true; break; case "alpha": this.alpha = parseFloat(paramVal) * proj4.common.D2R; break; //for somerc projection case "lonc": this.longc = paramVal * proj4.common.D2R; break; //for somerc projection case "x_0": this.x0 = parseFloat(paramVal); break; // false easting case "y_0": this.y0 = parseFloat(paramVal); break; // false northing case "k_0": this.k0 = parseFloat(paramVal); break; // projection scale factor case "k": this.k0 = parseFloat(paramVal); break; // both forms returned case "r_a": this.R_A = true; break; // sphere--area of ellipsoid case "zone": this.zone = parseInt(paramVal, 10); break; // UTM Zone case "south": this.utmSouth = true; break; // UTM north/south case "towgs84": this.datum_params = paramVal.split(","); break; case "to_meter": this.to_meter = parseFloat(paramVal); break; // cartesian scaling case "from_greenwich": this.from_greenwich = paramVal * proj4.common.D2R; break; case "czech": this.czech = true; break; // DGR 2008-07-09 : if pm is not a well-known prime meridian take // the value instead of 0.0, then convert to radians case "pm": paramVal = paramVal.replace(/\s/gi,""); this.from_greenwich = proj4.PrimeMeridian[paramVal] ? proj4.PrimeMeridian[paramVal] : parseFloat(paramVal); case "pm": paramVal = paramVal.replace(/\s/gi, ""); this.from_greenwich = proj4.PrimeMeridian[paramVal] ? proj4.PrimeMeridian[paramVal] : parseFloat(paramVal); this.from_greenwich *= proj4.common.D2R; break; // DGR 2010-11-12: axis case "axis": paramVal = paramVal.replace(/\s/gi,""); case "axis": paramVal = paramVal.replace(/\s/gi, ""); var legalAxis = "ewnsud"; if (paramVal.length===3 && legalAxis.indexOf(paramVal.substr(0,1))!=-1 && legalAxis.indexOf(paramVal.substr(1,1))!=-1 && legalAxis.indexOf(paramVal.substr(2,1))!=-1) { if (paramVal.length === 3 && legalAxis.indexOf(paramVal.substr(0, 1)) !== -1 && legalAxis.indexOf(paramVal.substr(1, 1)) !== -1 && legalAxis.indexOf(paramVal.substr(2, 1)) !== -1) { this.axis = paramVal; } //FIXME: be silent ? break; case "wktext": break;//DGR 2012-07-29 case "no_defs": break; default: //alert("Unrecognized parameter: " + paramName); case "wktext": break; //DGR 2012-07-29 case "no_defs": break; default: //alert("Unrecognized parameter: " + paramName); } // switch() } // for paramArray this.deriveConstants(); Loading @@ -411,7 +503,8 @@ proj4.Proj = proj4.Class({ } if (this.nadgrids) { this.grids = this.nadgrids.split(","); var g= null, l= this.grids.length; var g = null, l = this.grids.length; if (l > 0) { for (var i = 0; i < l; i++) { g = this.grids[i]; Loading Loading @@ -445,7 +538,9 @@ proj4.Proj = proj4.Class({ var ellipse = proj4.Ellipsoid[this.ellps] ? proj4.Ellipsoid[this.ellps] : proj4.Ellipsoid.WGS84; proj4.extend(this, ellipse); } if (this.rf && !this.b) this.b = (1.0 - 1.0/this.rf) * this.a; if (this.rf && !this.b){ this.b = (1.0 - 1.0 / this.rf) * this.a; } if (this.rf === 0 || Math.abs(this.a - this.b) < proj4.common.EPSLN) { this.sphere = true; this.b = this.a; Loading @@ -461,9 +556,13 @@ proj4.Proj = proj4.Class({ this.es = 0; } this.ep2 = (this.a2 - this.b2) / this.b2; // used in geocentric if (!this.k0) this.k0 = 1.0; //default value if (!this.k0){ this.k0 = 1.0; //default value } //DGR 2010-11-12: axis if (!this.axis) { this.axis= "enu"; } if (!this.axis) { this.axis = "enu"; } this.datum = new proj4.datum(this); } Loading Loading
src/Proj.js +599 −500 Original line number Diff line number Diff line /** * Class: proj4.Proj * Loading Loading @@ -80,36 +79,35 @@ proj4.Proj = proj4.Class({ } //check to see if this is a WKT string if ((srsCode.indexOf('GEOGCS') >= 0) || (srsCode.indexOf('GEOCCS') >= 0) || (srsCode.indexOf('PROJCS') >= 0) || (srsCode.indexOf('LOCAL_CS') >= 0)) { if ((srsCode.indexOf('GEOGCS') >= 0) || (srsCode.indexOf('GEOCCS') >= 0) || (srsCode.indexOf('PROJCS') >= 0) || (srsCode.indexOf('LOCAL_CS') >= 0)) { this.parseWKT(srsCode); this.deriveConstants(); //this.loadProjCode(this.projName); }else{ } else { // DGR 2008-08-03 : support urn and url if (srsCode.indexOf('urn:') === 0) { //urn:ORIGINATOR:def:crs:CODESPACE:VERSION:ID var urn = srsCode.split(':'); if ((urn[1] === 'ogc' || urn[1] =='x-ogc') && (urn[2] ==='def') && (urn[3] ==='crs')) { if ((urn[1] === 'ogc' || urn[1] === 'x-ogc') && (urn[2] === 'def') && (urn[3] === 'crs')) { srsCode = urn[4] + ':' + urn[urn.length - 1]; } } else if (srsCode.indexOf('http://') === 0) { } else if (srsCode.indexOf('http://') === 0) { //url#ID var url = srsCode.split('#'); if (url[0].match(/epsg.org/)) { // http://www.epsg.org/# srsCode = 'EPSG:' + url[1]; } else if (url[0].match(/RIG.xml/)) { } else if (url[0].match(/RIG.xml/)) { //http://librairies.ign.fr/geoportail/resources/RIG.xml# //http://interop.ign.fr/registers/ign/RIG.xml# srsCode = 'IGNF:' + url[1]; } else if (url[0].indexOf('/def/crs/')!=-1) { } else if (url[0].indexOf('/def/crs/') !== -1) { // http://www.opengis.net/def/crs/EPSG/0/code url = srsCode.split('/'); srsCode = url.pop(); //code Loading @@ -123,16 +121,19 @@ proj4.Proj = proj4.Class({ this.srsAuth = 'epsg'; this.srsProjNumber = this.srsCode.substring(5); // DGR 2007-11-20 : authority IGNF } else if (this.srsCode.indexOf("IGNF") === 0) { } else if (this.srsCode.indexOf("IGNF") === 0) { this.srsCode = this.srsCode; this.srsAuth = 'IGNF'; this.srsProjNumber = this.srsCode.substring(5); // DGR 2008-06-19 : pseudo-authority CRS for WMS } else if (this.srsCode.indexOf("CRS") === 0) { } else if (this.srsCode.indexOf("CRS") === 0) { this.srsCode = this.srsCode; this.srsAuth = 'CRS'; this.srsProjNumber = this.srsCode.substring(4); } else { } else { this.srsAuth = ''; this.srsProjNumber = this.srsCode; } Loading Loading @@ -169,14 +170,17 @@ proj4.Proj = proj4.Class({ wktRE: /^(\w+)\[(.*)\]$/, parseWKT: function(wkt) { var wktMatch = wkt.match(this.wktRE); if (!wktMatch) return; if (!wktMatch){ return; } var wktObject = wktMatch[1]; var wktContent = wktMatch[2]; var wktTemp = wktContent.split(","); var wktName; if (wktObject.toUpperCase() === "TOWGS84") { wktName = wktObject; //no name supplied for the TOWGS84 array } else { } else { wktName = wktTemp.shift(); } wktName = wktName.replace(/^\"/, ""); Loading @@ -196,14 +200,19 @@ proj4.Proj = proj4.Class({ for (var i = 0; i < wktTemp.length; ++i) { var token = wktTemp[i]; for (var j2 = 0; j2 < token.length; ++j2) { if (token.charAt(j2) === "[") ++bkCount; if (token.charAt(j2) === "]") --bkCount; if (token.charAt(j2) === "["){ ++bkCount; } if (token.charAt(j2) === "]"){ --bkCount; } } obj += token; if (bkCount === 0) { wktArray.push(obj); obj = ""; } else { } else { obj += ","; } } Loading @@ -219,7 +228,9 @@ proj4.Proj = proj4.Class({ case 'GEOGCS': this.projName = 'longlat'; this.geocsCode = wktName; if (!this.srsCode) this.srsCode = wktName; if (!this.srsCode){ this.srsCode = wktName; } break; case 'PROJCS': this.srsCode = wktName; Loading Loading @@ -282,21 +293,44 @@ proj4.Proj = proj4.Class({ name = wktName.toLowerCase(); value = wktArray.shift(); switch (value) { case 'EAST' : value= 'e'; break; case 'WEST' : value= 'w'; break; case 'NORTH': value= 'n'; break; case 'SOUTH': value= 's'; break; case 'UP' : value= 'u'; break; case 'DOWN' : value= 'd'; break; case 'EAST': value = 'e'; break; case 'WEST': value = 'w'; break; case 'NORTH': value = 'n'; break; case 'SOUTH': value = 's'; break; case 'UP': value = 'u'; break; case 'DOWN': value = 'd'; break; //case 'OTHER': default : value= ' '; break;//FIXME default: value = ' '; break; //FIXME } if (!this.axis) { this.axis = "enu"; } if (!this.axis) { this.axis= "enu"; } switch (name) { case 'x': this.axis= value + this.axis.substr(1,2); break; case 'y': this.axis= this.axis.substr(0,1) + value + this.axis.substr(2,1); break; case 'z': this.axis= this.axis.substr(0,2) + value ; break; default : break; case 'x': this.axis = value + this.axis.substr(1, 2); break; case 'y': this.axis = this.axis.substr(0, 1) + value + this.axis.substr(2, 1); break; case 'z': this.axis = this.axis.substr(0, 2) + value; break; default: break; } break; case 'MORE_HERE': Loading @@ -315,12 +349,7 @@ proj4.Proj = proj4.Class({ * */ parseDefs: function() { var re= new RegExp('(title|proj|units|datum|nadgrids|'+ 'ellps|a|b|rf|'+ 'lat_0|lat_1|lat_2|lat_ts|lon_0|lon_1|lon_2|alpha|lonc|'+ 'x_0|y_0|k_0|k|r_a|zone|south|'+ 'towgs84|to_meter|from_greenwich|pm|axis|czech|'+ 'wktext|no_rot|no_off|no_defs)'); var re = new RegExp('(title|proj|units|datum|nadgrids|' + 'ellps|a|b|rf|' + 'lat_0|lat_1|lat_2|lat_ts|lon_0|lon_1|lon_2|alpha|lonc|' + 'x_0|y_0|k_0|k|r_a|zone|south|' + 'towgs84|to_meter|from_greenwich|pm|axis|czech|' + 'wktext|no_rot|no_off|no_defs)'); this.defData = proj4.defs[this.srsCode]; var paramName, paramVal; if (!this.defData) { Loading @@ -334,65 +363,128 @@ proj4.Proj = proj4.Class({ paramVal = property[1]; switch (paramName.replace(/\s/gi, "")) { // trim out spaces case "": break; // throw away nameless parameter case "": break; // throw away nameless parameter // DGR 2012-10-13 : + in title (EPSG:2056: CH1903+ / LV95) case "title": this.title = paramVal; case "title": this.title = paramVal; while (!paramArray[prop + 1].match(re)) { this.title += '+' + paramArray[++prop]; } break; case "proj": this.projName = paramVal.replace(/\s/gi,""); break; case "units": this.units = paramVal.replace(/\s/gi,""); break; case "datum": this.datumCode = paramVal.replace(/\s/gi,""); break; case "proj": this.projName = paramVal.replace(/\s/gi, ""); break; case "units": this.units = paramVal.replace(/\s/gi, ""); break; case "datum": this.datumCode = paramVal.replace(/\s/gi, ""); break; // DGR 2011-03-20 : nagrids -> nadgrids case "nadgrids": this.nadgrids = paramVal.replace(/\s/gi,""); break;// DGR 2012-07-29 case "ellps": this.ellps = paramVal.replace(/\s/gi,""); break; case "a": this.a = parseFloat(paramVal); break; // semi-major radius case "b": this.b = parseFloat(paramVal); break; // semi-minor radius case "nadgrids": this.nadgrids = paramVal.replace(/\s/gi, ""); break; // DGR 2012-07-29 case "ellps": this.ellps = paramVal.replace(/\s/gi, ""); break; case "a": this.a = parseFloat(paramVal); break; // semi-major radius case "b": this.b = parseFloat(paramVal); break; // semi-minor radius // DGR 2007-11-20 case "rf": this.rf = parseFloat(paramVal); break; // inverse flattening rf= a/(a-b) case "lat_0": this.lat0 = paramVal*proj4.common.D2R; break; // phi0, central latitude case "lat_1": this.lat1 = paramVal*proj4.common.D2R; break; //standard parallel 1 case "lat_2": this.lat2 = paramVal*proj4.common.D2R; break; //standard parallel 2 case "lat_ts": this.lat_ts = paramVal*proj4.common.D2R; break; // used in merc and eqc case "lon_0": this.long0 = paramVal*proj4.common.D2R; break; // lam0, central longitude case "lon_1": this.long1 = paramVal*proj4.common.D2R; break; case "lon_2": this.long2 = paramVal*proj4.common.D2R; break; case "no_rot": this.no_rot = true; break; case "no_off": this.no_off = true; break; case "alpha": this.alpha = parseFloat(paramVal)*proj4.common.D2R; break; //for somerc projection case "lonc": this.longc = paramVal*proj4.common.D2R; break; //for somerc projection case "x_0": this.x0 = parseFloat(paramVal); break; // false easting case "y_0": this.y0 = parseFloat(paramVal); break; // false northing case "k_0": this.k0 = parseFloat(paramVal); break; // projection scale factor case "k": this.k0 = parseFloat(paramVal); break; // both forms returned case "r_a": this.R_A = true; break; // sphere--area of ellipsoid case "zone": this.zone = parseInt(paramVal,10); break; // UTM Zone case "south": this.utmSouth = true; break; // UTM north/south case "towgs84":this.datum_params = paramVal.split(","); break; case "to_meter": this.to_meter = parseFloat(paramVal); break; // cartesian scaling case "from_greenwich": this.from_greenwich = paramVal*proj4.common.D2R; break; case "czech": this.czech = true; break; case "rf": this.rf = parseFloat(paramVal); break; // inverse flattening rf= a/(a-b) case "lat_0": this.lat0 = paramVal * proj4.common.D2R; break; // phi0, central latitude case "lat_1": this.lat1 = paramVal * proj4.common.D2R; break; //standard parallel 1 case "lat_2": this.lat2 = paramVal * proj4.common.D2R; break; //standard parallel 2 case "lat_ts": this.lat_ts = paramVal * proj4.common.D2R; break; // used in merc and eqc case "lon_0": this.long0 = paramVal * proj4.common.D2R; break; // lam0, central longitude case "lon_1": this.long1 = paramVal * proj4.common.D2R; break; case "lon_2": this.long2 = paramVal * proj4.common.D2R; break; case "no_rot": this.no_rot = true; break; case "no_off": this.no_off = true; break; case "alpha": this.alpha = parseFloat(paramVal) * proj4.common.D2R; break; //for somerc projection case "lonc": this.longc = paramVal * proj4.common.D2R; break; //for somerc projection case "x_0": this.x0 = parseFloat(paramVal); break; // false easting case "y_0": this.y0 = parseFloat(paramVal); break; // false northing case "k_0": this.k0 = parseFloat(paramVal); break; // projection scale factor case "k": this.k0 = parseFloat(paramVal); break; // both forms returned case "r_a": this.R_A = true; break; // sphere--area of ellipsoid case "zone": this.zone = parseInt(paramVal, 10); break; // UTM Zone case "south": this.utmSouth = true; break; // UTM north/south case "towgs84": this.datum_params = paramVal.split(","); break; case "to_meter": this.to_meter = parseFloat(paramVal); break; // cartesian scaling case "from_greenwich": this.from_greenwich = paramVal * proj4.common.D2R; break; case "czech": this.czech = true; break; // DGR 2008-07-09 : if pm is not a well-known prime meridian take // the value instead of 0.0, then convert to radians case "pm": paramVal = paramVal.replace(/\s/gi,""); this.from_greenwich = proj4.PrimeMeridian[paramVal] ? proj4.PrimeMeridian[paramVal] : parseFloat(paramVal); case "pm": paramVal = paramVal.replace(/\s/gi, ""); this.from_greenwich = proj4.PrimeMeridian[paramVal] ? proj4.PrimeMeridian[paramVal] : parseFloat(paramVal); this.from_greenwich *= proj4.common.D2R; break; // DGR 2010-11-12: axis case "axis": paramVal = paramVal.replace(/\s/gi,""); case "axis": paramVal = paramVal.replace(/\s/gi, ""); var legalAxis = "ewnsud"; if (paramVal.length===3 && legalAxis.indexOf(paramVal.substr(0,1))!=-1 && legalAxis.indexOf(paramVal.substr(1,1))!=-1 && legalAxis.indexOf(paramVal.substr(2,1))!=-1) { if (paramVal.length === 3 && legalAxis.indexOf(paramVal.substr(0, 1)) !== -1 && legalAxis.indexOf(paramVal.substr(1, 1)) !== -1 && legalAxis.indexOf(paramVal.substr(2, 1)) !== -1) { this.axis = paramVal; } //FIXME: be silent ? break; case "wktext": break;//DGR 2012-07-29 case "no_defs": break; default: //alert("Unrecognized parameter: " + paramName); case "wktext": break; //DGR 2012-07-29 case "no_defs": break; default: //alert("Unrecognized parameter: " + paramName); } // switch() } // for paramArray this.deriveConstants(); Loading @@ -411,7 +503,8 @@ proj4.Proj = proj4.Class({ } if (this.nadgrids) { this.grids = this.nadgrids.split(","); var g= null, l= this.grids.length; var g = null, l = this.grids.length; if (l > 0) { for (var i = 0; i < l; i++) { g = this.grids[i]; Loading Loading @@ -445,7 +538,9 @@ proj4.Proj = proj4.Class({ var ellipse = proj4.Ellipsoid[this.ellps] ? proj4.Ellipsoid[this.ellps] : proj4.Ellipsoid.WGS84; proj4.extend(this, ellipse); } if (this.rf && !this.b) this.b = (1.0 - 1.0/this.rf) * this.a; if (this.rf && !this.b){ this.b = (1.0 - 1.0 / this.rf) * this.a; } if (this.rf === 0 || Math.abs(this.a - this.b) < proj4.common.EPSLN) { this.sphere = true; this.b = this.a; Loading @@ -461,9 +556,13 @@ proj4.Proj = proj4.Class({ this.es = 0; } this.ep2 = (this.a2 - this.b2) / this.b2; // used in geocentric if (!this.k0) this.k0 = 1.0; //default value if (!this.k0){ this.k0 = 1.0; //default value } //DGR 2010-11-12: axis if (!this.axis) { this.axis= "enu"; } if (!this.axis) { this.axis = "enu"; } this.datum = new proj4.datum(this); } Loading