source:
trunk/workshop-routing-foss4g/web/proj4js/lib/projCode/mill.js
@
77
Revision 76, 2.4 KB checked in by djay, 13 years ago (diff) | |
---|---|
|
Line | |
---|---|
1 | /******************************************************************************* |
2 | NAME MILLER CYLINDRICAL |
3 | |
4 | PURPOSE: Transforms input longitude and latitude to Easting and |
5 | Northing for the Miller Cylindrical projection. The |
6 | longitude and latitude must be in radians. The Easting |
7 | and Northing values will be returned in meters. |
8 | |
9 | PROGRAMMER DATE |
10 | ---------- ---- |
11 | T. Mittan March, 1993 |
12 | |
13 | This function was adapted from the Lambert Azimuthal Equal Area projection |
14 | code (FORTRAN) in the General Cartographic Transformation Package software |
15 | which is available from the U.S. Geological Survey National Mapping Division. |
16 | |
17 | ALGORITHM REFERENCES |
18 | |
19 | 1. "New Equal-Area Map Projections for Noncircular Regions", John P. Snyder, |
20 | The American Cartographer, Vol 15, No. 4, October 1988, pp. 341-355. |
21 | |
22 | 2. Snyder, John P., "Map Projections--A Working Manual", U.S. Geological |
23 | Survey Professional Paper 1395 (Supersedes USGS Bulletin 1532), United |
24 | State Government Printing Office, Washington D.C., 1987. |
25 | |
26 | 3. "Software Documentation for GCTP General Cartographic Transformation |
27 | Package", U.S. Geological Survey National Mapping Division, May 1982. |
28 | *******************************************************************************/ |
29 | |
30 | Proj4js.Proj.mill = { |
31 | |
32 | /* Initialize the Miller Cylindrical projection |
33 | -------------------------------------------*/ |
34 | init: function() { |
35 | //no-op |
36 | }, |
37 | |
38 | |
39 | /* Miller Cylindrical forward equations--mapping lat,long to x,y |
40 | ------------------------------------------------------------*/ |
41 | forward: function(p) { |
42 | var lon=p.x; |
43 | var lat=p.y; |
44 | /* Forward equations |
45 | -----------------*/ |
46 | var dlon = Proj4js.common.adjust_lon(lon -this.long0); |
47 | var x = this.x0 + this.a * dlon; |
48 | var y = this.y0 + this.a * Math.log(Math.tan((Proj4js.common.PI / 4.0) + (lat / 2.5))) * 1.25; |
49 | |
50 | p.x=x; |
51 | p.y=y; |
52 | return p; |
53 | },//millFwd() |
54 | |
55 | /* Miller Cylindrical inverse equations--mapping x,y to lat/long |
56 | ------------------------------------------------------------*/ |
57 | inverse: function(p) { |
58 | p.x -= this.x0; |
59 | p.y -= this.y0; |
60 | |
61 | var lon = Proj4js.common.adjust_lon(this.long0 + p.x /this.a); |
62 | var lat = 2.5 * (Math.atan(Math.exp(0.8*p.y/this.a)) - Proj4js.common.PI / 4.0); |
63 | |
64 | p.x=lon; |
65 | p.y=lat; |
66 | return p; |
67 | }//millInv() |
68 | }; |
Note: See TracBrowser
for help on using the repository browser.