Commit 0567abd9 authored by Michael Adair's avatar Michael Adair
Browse files

closes #57: TOWGS84 doesn't include a name value so don't shift the wktObject...

closes #57: TOWGS84 doesn't include a name value so don't shift the wktObject array; also callbacks must be registered on the queue before WKT parsing
parent 7124a629
Loading
Loading
Loading
Loading
+12 −7
Original line number Diff line number Diff line
@@ -528,6 +528,12 @@ Proj4js.Proj = Proj4js.Class({
  initialize: function(srsCode, callback) {
      this.srsCodeInput = srsCode;
      
      //Register callbacks prior to attempting to process definition
      this.queue = [];
      if( callback ){
           this.queue.push( callback );
      }
      
      //check to see if this is a WKT string
      if ((srsCode.indexOf('GEOGCS') >= 0) ||
          (srsCode.indexOf('GEOCCS') >= 0) ||
@@ -580,12 +586,6 @@ Proj4js.Proj = Proj4js.Class({
          this.srsProjNumber = this.srsCode;
      }
      
      //Register callbacks prior to attempting to process definition
      this.queue = [];
      if( callback ){
           this.queue.push( callback );
      }
      
      this.loadProjDefinition();
  },
  
@@ -749,7 +749,12 @@ Proj4js.Proj = Proj4js.Class({
    var wktObject = wktMatch[1];
    var wktContent = wktMatch[2];
    var wktTemp = wktContent.split(",");
    var wktName = wktTemp.shift();
    var wktName;
    if (wktObject.toUpperCase() == "TOWGS84") {
      wktName = wktObject;  //no name supplied for the TOWGS84 array
    } else {
      wktName = wktTemp.shift();
    }
    wktName = wktName.replace(/^\"/,"");
    wktName = wktName.replace(/\"$/,"");