Commit c2db72ad authored by Richard Didier's avatar Richard Didier
Browse files

Skip null grid to avoid rounding errors : we know consider the null grid as identity grid !

parent 8f86ecef
Loading
Loading
Loading
Loading
+25 −13
Original line number Diff line number Diff line
@@ -271,11 +271,17 @@ var Proj4js = {
                continue;
            }
            /* If we have child nodes, check to see if any of them apply. */
            /* TODO : only plain grid has implemented ... */
            /* TODO : only plain grid has been implemented ... */
            /* we found a more refined child node to use */
            /* load the grid shift info if we don't have it. */
            /* TODO : Proj4js.grids pre-loaded (as they can be huge ...) */
            /* skip numerical computing error when "null" grid (identity grid): */
            if (gi.name=="null") {
                output.x= input.x;
                output.y= input.y;
            } else {
                output= Proj4js.common.nad_cvt(input, inverse, ct);
            }
            if (!isNaN(output.x)) {
                break;
            }
@@ -1073,10 +1079,15 @@ Proj4js.Proj = Proj4js.Class({
      }
      if (this.nadgrids) {
        this.grids= this.nadgrids.split(",");
        var g= null;
        for (var i= 0, l= this.grids.length; i<l; i++) {
        var g= null, l= this.grids.length;
        if (l>0) {
          for (var i= 0; i<l; i++) {
            g= this.grids[i];
            var fg= g.split("@");
            if (fg[fg.length-1]=="") {
              Proj4js.reportError("nadgrids syntax error '"+this.nadgrids+"' : empty grid found");
              continue;
            }
            this.grids[i]= {
              mandatory: fg.length==1,//@=> optional grid (no error if not found)
              name:fg[fg.length-1],
@@ -1086,6 +1097,7 @@ 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.
      }