source:
trunk/workshop-routing-foss4g/web/proj4js/lib/projCode/gstmerc.js
@
77
Revision 76, 1.9 KB checked in by djay, 13 years ago (diff) | |
---|---|
|
Line | |
---|---|
1 | Proj4js.Proj.gstmerc = { |
2 | init : function() { |
3 | |
4 | // array of: a, b, lon0, lat0, k0, x0, y0 |
5 | var temp= this.b / this.a; |
6 | this.e= Math.sqrt(1.0 - temp*temp); |
7 | this.lc= this.long0; |
8 | this.rs= Math.sqrt(1.0+this.e*this.e*Math.pow(Math.cos(this.lat0),4.0)/(1.0-this.e*this.e)); |
9 | var sinz= Math.sin(this.lat0); |
10 | var pc= Math.asin(sinz/this.rs); |
11 | var sinzpc= Math.sin(pc); |
12 | this.cp= Proj4js.common.latiso(0.0,pc,sinzpc)-this.rs*Proj4js.common.latiso(this.e,this.lat0,sinz); |
13 | this.n2= this.k0*this.a*Math.sqrt(1.0-this.e*this.e)/(1.0-this.e*this.e*sinz*sinz); |
14 | this.xs= this.x0; |
15 | this.ys= this.y0-this.n2*pc; |
16 | |
17 | if (!this.title) this.title = "Gauss Schreiber transverse mercator"; |
18 | }, |
19 | |
20 | |
21 | // forward equations--mapping lat,long to x,y |
22 | // ----------------------------------------------------------------- |
23 | forward : function(p) { |
24 | |
25 | var lon= p.x; |
26 | var lat= p.y; |
27 | |
28 | var L= this.rs*(lon-this.lc); |
29 | var Ls= this.cp+(this.rs*Proj4js.common.latiso(this.e,lat,Math.sin(lat))); |
30 | var lat1= Math.asin(Math.sin(L)/Proj4js.common.cosh(Ls)); |
31 | var Ls1= Proj4js.common.latiso(0.0,lat1,Math.sin(lat1)); |
32 | p.x= this.xs+(this.n2*Ls1); |
33 | p.y= this.ys+(this.n2*Math.atan(Proj4js.common.sinh(Ls)/Math.cos(L))); |
34 | return p; |
35 | }, |
36 | |
37 | // inverse equations--mapping x,y to lat/long |
38 | // ----------------------------------------------------------------- |
39 | inverse : function(p) { |
40 | |
41 | var x= p.x; |
42 | var y= p.y; |
43 | |
44 | var L= Math.atan(Proj4js.common.sinh((x-this.xs)/this.n2)/Math.cos((y-this.ys)/this.n2)); |
45 | var lat1= Math.asin(Math.sin((y-this.ys)/this.n2)/Proj4js.common.cosh((x-this.xs)/this.n2)); |
46 | var LC= Proj4js.common.latiso(0.0,lat1,Math.sin(lat1)); |
47 | p.x= this.lc+L/this.rs; |
48 | p.y= Proj4js.common.invlatiso(this.e,(LC-this.cp)/this.rs); |
49 | return p; |
50 | } |
51 | |
52 | }; |
Note: See TracBrowser
for help on using the repository browser.