Commit 912862ea authored by Calvin Metcalf's avatar Calvin Metcalf
Browse files

projection code now includes names

parent d5dd878e
Loading
Loading
Loading
Loading
+8 −5
Original line number Diff line number Diff line
@@ -7,7 +7,9 @@ define(function(require) {
  var projections = require('proj4/projections');
  var wkt = require('proj4/wkt');
  var projStr = require('proj4/projString');
  var proj = function proj(srsCode) {
  proj.projections = projections;
  proj.projections.start();
  function proj(srsCode) {
    if (!(this instanceof proj)) {
      return new proj(srsCode);
    }
@@ -42,11 +44,13 @@ define(function(require) {
     *
     */
    initTransforms: function(projName) {
      if (!(projName in proj.projections)) {
      var ourProj = proj.projections.get(projName);
      if(ourProj){
        extend(this, ourProj);
        this.init();
      }else{
        throw ("unknown projection " + projName);
      }
      extend(this, proj.projections[projName]);
      this.init();
    },
  
    deriveConstants: function(self) {
@@ -120,7 +124,6 @@ define(function(require) {
      self.datum = datum(self);
    }
  };
  proj.projections = projections;
  return proj;

});
+0 −40
Original line number Diff line number Diff line
@@ -316,46 +316,6 @@ define(function() {
  //proj4.WGS84 = Proj('WGS84');
  proj4.Datum.OSB36 = proj4.Datum.OSGB36; //as returned from spatialreference.org

  //lookup table to go from the projection name in WKT to the proj4 projection name
  //build this out as required
  proj4.wktProjections = {
    "Lambert Tangential Conformal Conic Projection": "lcc",
    "Lambert_Conformal_Conic": "lcc",
    "Lambert_Conformal_Conic_2SP":"lcc",
    "Mercator": "merc",
    "Popular Visualisation Pseudo Mercator": "merc",
    "Mercator_1SP": "merc",
    "Transverse_Mercator": "tmerc",
    "Transverse Mercator": "tmerc",
    "Lambert Azimuthal Equal Area": "laea",
    "Universal Transverse Mercator System": "utm",
    "Hotine_Oblique_Mercator":"omerc",
    "Hotine Oblique Mercator":"omerc",
    "Hotine_Oblique_Mercator_Azimuth_Natural_Origin":"omerc",
    'Hotine_Oblique_Mercator_Azimuth_Center':'omerc',
    "Van_der_Grinten_I":"vandg",
    "VanDerGrinten":"vandg",
    "Stereographic_North_Pole":"sterea",
    "Oblique_Stereographic":"sterea",
    'Polar_Stereographic':"sterea",
    "Polyconic":"poly",
    'New_Zealand_Map_Grid':'nzmg',
    'Miller_Cylindrical':'mill',
    'Krovak':'krovak',
    'Equirectangular':'eqc',
    'Equidistant_Cylindrical':'eqc',
    'Cassini':'cass',
    'Cassini_Soldner':'cass',
    'Azimuthal_Equidistant':'aeqd',
    'Albers_Conic_Equal_Area':'aea',
    'Albers':'aea',
    'Mollweide':'moll',
    'Lambert_Azimuthal_Equal_Area':'laea',
    'Sinusoidal':"sinu",
    "Equidistant_Conic":'eqdc',
    'Mercator_Auxiliary_Sphere':'merc'
  };

  // Based on proj4 CTABLE  structure :
  // FIXME: better to have array instead of object holding longitudes, latitudes members
  //        In the former case, one has to document index 0 is longitude and
+14 −13
Original line number Diff line number Diff line
define(function(require) {
define(function(require, exports) {
  var common = require('proj4/common');
  return {
    init: function() {
  exports.init = function() {

      if (Math.abs(this.lat1 + this.lat2) < common.EPSLN) {
        //proj4.reportError("aeaInitEqualLatitudes");
@@ -37,11 +36,11 @@ define(function(require) {
      }
      this.c = this.ms1 * this.ms1 + this.ns0 * this.qs1;
      this.rh = this.a * Math.sqrt(this.c - this.ns0 * this.qs0) / this.ns0;
    },
    };

    /* Albers Conical Equal Area forward equations--mapping lat,long to x,y
  -------------------------------------------------------------------*/
    forward: function(p) {
    exports.forward = function(p) {

      var lon = p.x;
      var lat = p.y;
@@ -58,10 +57,10 @@ define(function(require) {
      p.x = x;
      p.y = y;
      return p;
    },
    };


    inverse: function(p) {
    exports.inverse = function(p) {
      var rh1, qs, con, theta, lon, lat;

      p.x -= this.x0;
@@ -91,12 +90,12 @@ define(function(require) {
      p.x = lon;
      p.y = lat;
      return p;
    },
    };

    /* Function to compute phi1, the latitude for the inverse of the
   Albers Conical Equal-Area projection.
-------------------------------------------*/
    phi1z: function(eccent, qs) {
    exports.phi1z = function(eccent, qs) {
      var sinphi, cosphi, con, com, dphi;
      var phi = common.asinz(0.5 * qs);
      if (eccent < common.EPSLN) {
@@ -117,8 +116,10 @@ define(function(require) {
      }
      //proj4.reportError("aea:phi1z:Convergence error");
      return null;
    }

    };

exports.names = [
        "Albers_Conic_Equal_Area",
        "Albers",
        "aea"
    ];
});
+157 −160
Original line number Diff line number Diff line
define(function(require) {
define(function(require, exports) {
  var common = require('proj4/common');
  return {

    init: function() {
  exports.init = function() {
    this.sin_p12 = Math.sin(this.lat0);
    this.cos_p12 = Math.cos(this.lat0);
    },
  };

    forward: function(p) {
  exports.forward = function(p) {
    var lon = p.x;
    var lat = p.y;
    var sinphi = Math.sin(p.y);
@@ -90,9 +88,9 @@ define(function(require) {
    }


    },
  };

    inverse: function(p) {
  exports.inverse = function(p) {
    p.x -= this.x0;
    p.y -= this.y0;
    var rh, z, sinz, cosz, lon, lat, con, e0, e1, e2, e3, Mlp, M, N1, psi, Az, cosAz, tmp, A, B, D, Ee, F;
@@ -187,7 +185,6 @@ define(function(require) {
      }
    }

    }
  };

  exports.names = ["Azimuthal_Equidistant","aeqd"];
});
+79 −82
Original line number Diff line number Diff line
define(function(require) {
define(function(require, exports) {
  var common = require('proj4/common');
  return {
    init: function() {
  exports.init = function() {
    if (!this.sphere) {
      this.e0 = common.e0fn(this.es);
      this.e1 = common.e1fn(this.es);
@@ -9,13 +8,13 @@ define(function(require) {
      this.e3 = common.e3fn(this.es);
      this.ml0 = this.a * common.mlfn(this.e0, this.e1, this.e2, this.e3, this.lat0);
    }
    },
  };



  /* Cassini forward equations--mapping lat,long to x,y
  -----------------------------------------------------------------------*/
    forward: function(p) {
  exports.forward = function(p) {

    /* Forward equations
      -----------------*/
@@ -48,11 +47,11 @@ define(function(require) {
    p.x = x + this.x0;
    p.y = y + this.y0;
    return p;
    }, //cassFwd()
  };

  /* Inverse equations
  -----------------*/
    inverse: function(p) {
  exports.inverse = function(p) {
    p.x -= this.x0;
    p.y -= this.y0;
    var x = p.x / this.a;
@@ -91,8 +90,6 @@ define(function(require) {
    p.y = common.adjust_lat(phi);
    return p;

    } //cassInv()

  };

  exports.names = ["Cassini", "Cassini_Soldner", "cass"];
});
Loading