[76] | 1 | /******************************************************************************* |
---|
| 2 | NAME LAMBERT CYLINDRICAL EQUAL AREA |
---|
| 3 | |
---|
| 4 | PURPOSE: Transforms input longitude and latitude to Easting and |
---|
| 5 | Northing for the Lambert Cylindrical Equal Area projection. |
---|
| 6 | This class of projection includes the Behrmann and |
---|
| 7 | Gall-Peters Projections. The |
---|
| 8 | longitude and latitude must be in radians. The Easting |
---|
| 9 | and Northing values will be returned in meters. |
---|
| 10 | |
---|
| 11 | PROGRAMMER DATE |
---|
| 12 | ---------- ---- |
---|
| 13 | R. Marsden August 2009 |
---|
| 14 | Winwaed Software Tech LLC, http://www.winwaed.com |
---|
| 15 | |
---|
| 16 | This function was adapted from the Miller Cylindrical Projection in the Proj4JS |
---|
| 17 | library. |
---|
| 18 | |
---|
| 19 | Note: This implementation assumes a Spherical Earth. The (commented) code |
---|
| 20 | has been included for the ellipsoidal forward transform, but derivation of |
---|
| 21 | the ellispoidal inverse transform is beyond me. Note that most of the |
---|
| 22 | Proj4JS implementations do NOT currently support ellipsoidal figures. |
---|
| 23 | Therefore this is not seen as a problem - especially this lack of support |
---|
| 24 | is explicitly stated here. |
---|
| 25 | |
---|
| 26 | ALGORITHM REFERENCES |
---|
| 27 | |
---|
| 28 | 1. "Cartographic Projection Procedures for the UNIX Environment - |
---|
| 29 | A User's Manual" by Gerald I. Evenden, USGS Open File Report 90-284 |
---|
| 30 | and Release 4 Interim Reports (2003) |
---|
| 31 | |
---|
| 32 | 2. Snyder, John P., "Flattening the Earth - Two Thousand Years of Map |
---|
| 33 | Projections", Univ. Chicago Press, 1993 |
---|
| 34 | *******************************************************************************/ |
---|
| 35 | |
---|
| 36 | Proj4js.Proj.cea = { |
---|
| 37 | |
---|
| 38 | /* Initialize the Cylindrical Equal Area projection |
---|
| 39 | -------------------------------------------*/ |
---|
| 40 | init: function() { |
---|
| 41 | //no-op |
---|
| 42 | }, |
---|
| 43 | |
---|
| 44 | |
---|
| 45 | /* Cylindrical Equal Area forward equations--mapping lat,long to x,y |
---|
| 46 | ------------------------------------------------------------*/ |
---|
| 47 | forward: function(p) { |
---|
| 48 | var lon=p.x; |
---|
| 49 | var lat=p.y; |
---|
| 50 | /* Forward equations |
---|
| 51 | -----------------*/ |
---|
| 52 | dlon = Proj4js.common.adjust_lon(lon -this.long0); |
---|
| 53 | var x = this.x0 + this.a * dlon * Math.cos(this.lat_ts); |
---|
| 54 | var y = this.y0 + this.a * Math.sin(lat) / Math.cos(this.lat_ts); |
---|
| 55 | /* Elliptical Forward Transform |
---|
| 56 | Not implemented due to a lack of a matchign inverse function |
---|
| 57 | { |
---|
| 58 | var Sin_Lat = Math.sin(lat); |
---|
| 59 | var Rn = this.a * (Math.sqrt(1.0e0 - this.es * Sin_Lat * Sin_Lat )); |
---|
| 60 | x = this.x0 + this.a * dlon * Math.cos(this.lat_ts); |
---|
| 61 | y = this.y0 + Rn * Math.sin(lat) / Math.cos(this.lat_ts); |
---|
| 62 | } |
---|
| 63 | */ |
---|
| 64 | |
---|
| 65 | |
---|
| 66 | p.x=x; |
---|
| 67 | p.y=y; |
---|
| 68 | return p; |
---|
| 69 | },//ceaFwd() |
---|
| 70 | |
---|
| 71 | /* Cylindrical Equal Area inverse equations--mapping x,y to lat/long |
---|
| 72 | ------------------------------------------------------------*/ |
---|
| 73 | inverse: function(p) { |
---|
| 74 | p.x -= this.x0; |
---|
| 75 | p.y -= this.y0; |
---|
| 76 | |
---|
| 77 | var lon = Proj4js.common.adjust_lon( this.long0 + (p.x / this.a) / Math.cos(this.lat_ts) ); |
---|
| 78 | |
---|
| 79 | var lat = Math.asin( (p.y/this.a) * Math.cos(this.lat_ts) ); |
---|
| 80 | |
---|
| 81 | p.x=lon; |
---|
| 82 | p.y=lat; |
---|
| 83 | return p; |
---|
| 84 | }//ceaInv() |
---|
| 85 | }; |
---|