Loading lib/proj4js.js +34 −21 Original line number Diff line number Diff line Loading @@ -867,6 +867,12 @@ Proj4js.Proj = Proj4js.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|alpha|lonc|'+ 'x_0|y_0|k_0|k|r_a|zone|south|'+ 'towgs84|to_meter|from_greenwich|pm|axis|'+ 'wktext|no_defs)'); this.defData = Proj4js.defs[this.srsCode]; var paramName, paramVal; if (!this.defData) { Loading @@ -881,11 +887,17 @@ Proj4js.Proj = Proj4js.Class({ switch (paramName.replace(/\s/gi,"")) { // trim out spaces case "": break; // throw away nameless parameter case "title": this.title = paramVal; break; // DGR 2012-10-13 : + in title (EPSG:2056: CH1903+ / LV95) 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 "nadgrids": this.nagrids = 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 Loading Loading @@ -940,7 +952,8 @@ Proj4js.Proj = Proj4js.Class({ * */ deriveConstants: function() { if (this.nagrids == '@null') this.datumCode = 'none'; // DGR 2011-03-20 : nagrids -> nadgrids if (this.nadgrids == '@null') this.datumCode = 'none'; if (this.datumCode && this.datumCode != 'none') { var datumDef = Proj4js.Datum[this.datumCode]; if (datumDef) { Loading Loading @@ -1009,11 +1022,12 @@ Proj4js.Proj.identity = Proj4js.Proj.longlat; Proj4js.defs = { // These are so widely used, we'll go ahead and throw them in // without requiring a separate .js file 'WGS84': "+title=long/lat:WGS84 +proj=longlat +ellps=WGS84 +datum=WGS84 +units=degrees", 'EPSG:4326': "+title=long/lat:WGS84 +proj=longlat +a=6378137.0 +b=6356752.31424518 +ellps=WGS84 +datum=WGS84 +units=degrees", 'EPSG:4269': "+title=long/lat:NAD83 +proj=longlat +a=6378137.0 +b=6356752.31414036 +ellps=GRS80 +datum=NAD83 +units=degrees", '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" }; Proj4js.defs['EPSG:3785'] = Proj4js.defs['EPSG:3857']; //maintain backward compat, official code is 3857 Proj4js.defs['GOOGLE'] = Proj4js.defs['EPSG:3857']; Proj4js.defs['EPSG:900913'] = Proj4js.defs['EPSG:3857']; Proj4js.defs['EPSG:102113'] = Proj4js.defs['EPSG:3857']; Loading Loading @@ -1270,10 +1284,11 @@ Proj4js.datum = Proj4js.Class({ initialize : function(proj) { this.datum_type = Proj4js.common.PJD_WGS84; //default setting if (!proj) { return; } if (proj.datumCode && proj.datumCode == 'none') { this.datum_type = Proj4js.common.PJD_NODATUM; } if (proj && proj.datum_params) { if (proj.datum_params) { for (var i=0; i<proj.datum_params.length; i++) { proj.datum_params[i]=parseFloat(proj.datum_params[i]); } Loading @@ -1291,13 +1306,11 @@ Proj4js.datum = Proj4js.Class({ } } } if (proj) { this.a = proj.a; //datum object also uses these values this.b = proj.b; this.es = proj.es; this.ep2 = proj.ep2; this.datum_params = proj.datum_params; } }, /****************************************************************/ Loading Loading
lib/proj4js.js +34 −21 Original line number Diff line number Diff line Loading @@ -867,6 +867,12 @@ Proj4js.Proj = Proj4js.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|alpha|lonc|'+ 'x_0|y_0|k_0|k|r_a|zone|south|'+ 'towgs84|to_meter|from_greenwich|pm|axis|'+ 'wktext|no_defs)'); this.defData = Proj4js.defs[this.srsCode]; var paramName, paramVal; if (!this.defData) { Loading @@ -881,11 +887,17 @@ Proj4js.Proj = Proj4js.Class({ switch (paramName.replace(/\s/gi,"")) { // trim out spaces case "": break; // throw away nameless parameter case "title": this.title = paramVal; break; // DGR 2012-10-13 : + in title (EPSG:2056: CH1903+ / LV95) 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 "nadgrids": this.nagrids = 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 Loading Loading @@ -940,7 +952,8 @@ Proj4js.Proj = Proj4js.Class({ * */ deriveConstants: function() { if (this.nagrids == '@null') this.datumCode = 'none'; // DGR 2011-03-20 : nagrids -> nadgrids if (this.nadgrids == '@null') this.datumCode = 'none'; if (this.datumCode && this.datumCode != 'none') { var datumDef = Proj4js.Datum[this.datumCode]; if (datumDef) { Loading Loading @@ -1009,11 +1022,12 @@ Proj4js.Proj.identity = Proj4js.Proj.longlat; Proj4js.defs = { // These are so widely used, we'll go ahead and throw them in // without requiring a separate .js file 'WGS84': "+title=long/lat:WGS84 +proj=longlat +ellps=WGS84 +datum=WGS84 +units=degrees", 'EPSG:4326': "+title=long/lat:WGS84 +proj=longlat +a=6378137.0 +b=6356752.31424518 +ellps=WGS84 +datum=WGS84 +units=degrees", 'EPSG:4269': "+title=long/lat:NAD83 +proj=longlat +a=6378137.0 +b=6356752.31414036 +ellps=GRS80 +datum=NAD83 +units=degrees", '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" }; Proj4js.defs['EPSG:3785'] = Proj4js.defs['EPSG:3857']; //maintain backward compat, official code is 3857 Proj4js.defs['GOOGLE'] = Proj4js.defs['EPSG:3857']; Proj4js.defs['EPSG:900913'] = Proj4js.defs['EPSG:3857']; Proj4js.defs['EPSG:102113'] = Proj4js.defs['EPSG:3857']; Loading Loading @@ -1270,10 +1284,11 @@ Proj4js.datum = Proj4js.Class({ initialize : function(proj) { this.datum_type = Proj4js.common.PJD_WGS84; //default setting if (!proj) { return; } if (proj.datumCode && proj.datumCode == 'none') { this.datum_type = Proj4js.common.PJD_NODATUM; } if (proj && proj.datum_params) { if (proj.datum_params) { for (var i=0; i<proj.datum_params.length; i++) { proj.datum_params[i]=parseFloat(proj.datum_params[i]); } Loading @@ -1291,13 +1306,11 @@ Proj4js.datum = Proj4js.Class({ } } } if (proj) { this.a = proj.a; //datum object also uses these values this.b = proj.b; this.es = proj.es; this.ep2 = proj.ep2; this.datum_params = proj.datum_params; } }, /****************************************************************/ Loading