PageSourceSearch

https://www.literaturportal-bayern.de/templates/yoo_master2/styles/lpb/js/Geo.js

js literaturportal-bayern.de collected 2026-10-02 06:58:57 UTC 22,914 bytes, 771 lines download raw bytes

1// JavaScript Document
2function geo2utm(lw,bw)
3{
4/* Copyright (c) 2006, HELMUT H. HEIMEIER
5   Permission is hereby granted, free of charge, to any person obtaining a
6   copy of this software and associated documentation files (the "Software"),
7   to deal in the Software without restriction, including without limitation
8   the rights to use, copy, modify, merge, publish, distribute, sublicense,
9   and/or sell copies of the Software, and to permit persons to whom the
10   Software is furnished to do so, subject to the following conditions:
11   The above copyright notice and this permission notice shall be included
12   in all copies or substantial portions of the Software.*/
13
14/* Die Funktion wandelt geographische Koordinaten in UTM Koordinaten
15   um. Geographische Länge lw und Breite bw müssen im WGS84 Datum
16   gegeben sein. Berechnet werden UTM Zone, Ostwert ew und Nordwert nw.
17*/
18// Geographische Länge lw und Breite bw im WGS84 Datum
19   alert('Hier spricht geo2utm' + lw);
20   if (lw =="" || bw == "")
21   {
22   zone = "";
23   ew = "";
24   nw = "";
25   return;
26   }
27   if (lw <= -180 || lw > 180 || bw <= -80 || bw >= 84)
28   {
29   alert("Werte nicht im Bereich des UTM Systems\n"+
30   "-180° <= LW < +180°, -80° < BW < 84° N");
31   zone = "";
32   ew = "";
33   nw = "";
34   return;
35   }
36   lw = parseFloat(lw);
37   bw = parseFloat(bw);
38
39// WGS84 Datum
40// Große Halbachse a und Abplattung f
41   a = 6378137.000;
42   f = 3.35281068e-3;
43   pi = Math.PI;
44   b_sel = 'CDEFGHJKLMNPQRSTUVWXX'
45
46// Polkrümmungshalbmesser c
47   c = a/(1-f);
48
49// Quadrat der zweiten numerischen Exzentrizität
50   ex2 = (2*f-f*f)/((1-f)*(1-f));
51   ex4 = ex2*ex2;
52   ex6 = ex4*ex2;
53   ex8 = ex4*ex4;
54
55// Koeffizienten zur Berechnung der Meridianbogenlänge
56   e0 = c*(pi/180)*(1 - 3*ex2/4 + 45*ex4/64 - 175*ex6/256 + 11025*ex8/16384);
57   e2 = c*( - 3*ex2/8 + 15*ex4/32 - 525*ex6/1024 +  2205*ex8/4096);
58   e4 = c*(15*ex4/256 - 105*ex6/1024 + 2205*ex8/16384);
59   e6 = c*( - 35*ex6/3072 + 315*ex8/12288);
60
61// Längenzone lz und Breitenzone (Band) bz
62   lzn = parseInt((lw+180)/6) + 1;
63   lz = lzn;
64   if (lzn < 10) lz = "0" + lzn;
65   bd = parseInt(1 + (bw + 80)/8);
66   bz = b_sel.substr(bd-1,1);
67
68// Geographische Breite in Radianten br
69   br = bw * pi/180;
70
71   tan1 = Math.tan(br);
72   tan2 = tan1*tan1;
73   tan4 = tan2*tan2;
74
75   cos1 = Math.cos(br);
76   cos2 = cos1*cos1;
77   cos4 = cos2*cos2;
78   cos3 = cos2*cos1;
79   cos5 = cos4*cos1;
80
81   etasq = ex2*cos2;
82
83// Querkrümmungshalbmesser nd
84   nd = c/Math.sqrt(1 + etasq);
85
86// Meridianbogenlänge g aus gegebener geographischer Breite bw
87   g = (e0*bw) + (e2*Math.sin(2*br)) + (e4*Math.sin(4*br)) + (e6*Math.sin(6*br));
88
89// Längendifferenz dl zum Bezugsmeridian lh
90   lh = (lzn - 30)*6 - 3;
91   dl = (lw - lh)*pi/180;
92   dl2 = dl*dl;
93   dl4 = dl2*dl2;
94   dl3 = dl2*dl;
95   dl5 = dl4*dl;
96
97// Maßstabsfaktor auf dem Bezugsmeridian bei UTM Koordinaten m = 0.9996
98// Nordwert nw und Ostwert ew als Funktion von geographischer Breite und Länge
99
100   if ( bw < 0 ) {
101      nw = 10e6 + 0.9996*(g + nd*cos2*tan1*dl2/2 + nd*cos4*tan1*(5-tan2+9*etasq)
102           *dl4/24);
103   }
104   else {
105      nw = 0.9996*(g + nd*cos2*tan1*dl2/2 + nd*cos4*tan1*(5-tan2+9*etasq)
106           *dl4/24);
107   }
108   ew = 0.9996*( nd*cos1*dl + nd*cos3*(1-tan2+etasq)*dl3/6 + nd*cos5
109        *(5-18*tan2+tan4)*dl5/120) + 500000;
110
111   zone = lz+bz;
112
113   nk = nw - parseInt(nw);
114   if (nk < 0.5) nw = "" + parseInt(nw)
115   else nw = "" + (parseInt(nw) + 1);
116
117   while (nw.length < 7)
118   {
119      nw = "0" + nw;
120   }
121
122   nk = ew - parseInt(ew);
123   if (nk < 0.5) ew = "0" + parseInt(ew)
124   else ew = "0" + parseInt(ew+1);
125   var h = new Object();
126   h['nw'] = nw;
127   h['ew'] = ew;
128   return h;
129}
130
131function utm2geo(zone,ew,nw)
132{
133/* Copyright (c) 2006, HELMUT H. HEIMEIER
134   Permission is hereby granted, free of charge, to any person obtaining a
135   copy of this software and associated documentation files (the "Software"),
136   to deal in the Software without restriction, including without limitation
137   the rights to use, copy, modify, merge, publish, distribute, sublicense,
138   and/or sell copies of the Software, and to permit persons to whom the
139   Software is furnished to do so, subject to the following conditions:
140   The above copyright notice and this permission notice shall be included
141   in all copies or substantial portions of the Software.*/
142
143/* Die Funktion wandelt UTM Koordinaten in geographische Koordinaten
144   um. UTM Zone, Ostwert ew und Nordwert nw müssen gegeben sein.
145   Berechnet werden geographische Länge lw und Breite bw im WGS84 Datum.
146*/
147// Längenzone zone, Ostwert ew und Nordwert nw im WGS84 Datum
148   if (zone == "" || ew == "" || nw == "")
149   {
150   zone = "";
151   ew = "";
152   nw = "";
153   return;
154   }
155   band = zone.substr(2,1);
156   zone = parseFloat(zone);
157   ew = parseFloat(ew);
158   nw = parseFloat(nw);
159
160// WGS84 Datum
161// Große Halbachse a und Abplattung f
162   a = 6378137.000;
163   f = 3.35281068e-3;
164   pi = Math.PI;
165
166// Polkrümmungshalbmesser c
167   c = a/(1-f);
168
169// Quadrat der zweiten numerischen Exzentrizität
170   ex2 = (2*f-f*f)/((1-f)*(1-f));
171   ex4 = ex2*ex2;
172   ex6 = ex4*ex2;
173   ex8 = ex4*ex4;
174
175// Koeffizienten zur Berechnung der geographischen Breite aus gegebener
176// Meridianbogenlänge
177   e0 = c*(pi/180)*(1 - 3*ex2/4 + 45*ex4/64 - 175*ex6/256 + 11025*ex8/16384);
178   f2 =   (180/pi)*(    3*ex2/8 - 3*ex4/16  + 213*ex6/2048 -  255*ex8/4096);
179   f4 =              (180/pi)*(  21*ex4/256 -  21*ex6/256  +  533*ex8/8192);
180   f6 =                           (180/pi)*(  151*ex6/6144 -  453*ex8/12288);
181
182// Entscheidung Nord-/Süd Halbkugel
183   if (band >= "N"|| band == "")
184      m_nw = nw
185   else
186      m_nw = nw - 10e6;
187
188// Geographische Breite bf zur Meridianbogenlänge gf = m_nw
189   sigma = (m_nw/0.9996)/e0;
190   sigmr = sigma*pi/180;
191   bf = sigma + f2*Math.sin(2*sigmr) + f4*Math.sin(4*sigmr)
192      + f6*Math.sin(6*sigmr);
193
194// Breite bf in Radianten
195   br = bf * pi/180;
196   tan1 = Math.tan(br);
197   tan2 = tan1*tan1;
198   tan4 = tan2*tan2;
199
200   cos1 = Math.cos(br);
201   cos2 = cos1*cos1;
202
203   etasq = ex2*cos2;
204
205// Querkrümmungshalbmesser nd
206   nd = c/Math.sqrt(1 + etasq);
207   nd2 = nd*nd;
208   nd4 = nd2*nd2;
209   nd6 = nd4*nd2;
210   nd3 = nd2*nd;
211   nd5 = nd4*nd;
212
213// Längendifferenz dl zum Bezugsmeridian lh
214   lh = (zone - 30)*6 - 3;
215   dy = (ew-500000)/0.9996;
216   dy2 = dy*dy;
217   dy4 = dy2*dy2;
218   dy3 = dy2*dy;
219   dy5 = dy3*dy2;
220   dy6 = dy3*dy3;
221
222   b2 = - tan1*(1+etasq)/(2*nd2);
223   b4 =   tan1*(5+3*tan2+6*etasq*(1-tan2))/(24*nd4);
224   b6 = - tan1*(61+90*tan2+45*tan4)/(720*nd6);
225
226   l1 =   1/(nd*cos1);
227   l3 = - (1+2*tan2+etasq)/(6*nd3*cos1);
228   l5 =   (5+28*tan2+24*tan4)/(120*nd5*cos1);
229
230// Geographische Breite bw und Länge lw als Funktion von Ostwert ew
231// und Nordwert nw
232   bw = bf + (180/pi) * (b2*dy2 + b4*dy4 + b6*dy6);
233   lw = lh + (180/pi) * (l1*dy  + l3*dy3 + l5*dy5);
234   return;
235}
236
237function utm2mgr(zone,ew,nw)
238{
239/* Copyright (c) 2006, HELMUT H. HEIMEIER
240   Permission is hereby granted, free of charge, to any person obtaining a
241   copy of this software and associated documentation files (the "Software"),
242   to deal in the Software without restriction, including without limitation
243   the rights to use, copy, modify, merge, publish, distribute, sublicense,
244   and/or sell copies of the Software, and to permit persons to whom the
245   Software is furnished to do so, subject to the following conditions:
246   The above copyright notice and this permission notice shall be included
247   in all copies or substantial portions of the Software.*/
248
249/* Die Funktion wandelt zivile UTM Koordinaten in militärische Koordinaten
250   um. UTM Zone zone, Ostwert ew und Nordwert nw müssen gegeben sein.
251   Zurückgegeben wird das Rasterfeld raster sowie die aus den
252   letzten 5 Stellen von Ost- und Nordwert gebildete Koordinatenangabe
253   UTMREF.
254*/
255// Längenzone zone, Ostwert ew und Nordwert nw im WGS84 Datum
256   if (zone == "" || ew == "" || nw == "")
257   {
258   zone = "";
259   ew = "";
260   nw = "";
261   return;
262   }
263
264   z1 = zone.substr(0,2);
265   z2 = zone.substr(2,1);
266   ew1 = parseInt(ew.substr(0,2));
267   nw1 = parseInt(nw.substr(0,2));
268   ew2 = ew.substr(2,5);
269   nw2 = nw.substr(2,5);
270
271   m_east = 'ABCDEFGHJKLMNPQRSTUVWXYZ'
272   m_north = 'ABCDEFGHJKLMNPQRSTUV'
273
274   if (z1 < "01" || z1 > "60" || z2 < "C" ||z2 > "X")
275   alert(z1 + z2 + " ist keine gültige UTM Zonenangabe");
276
277   i = z1 % 3;
278   if (i == 1) m_ce = ew1 - 1;
279   if (i == 2) m_ce = ew1 + 7;
280   if (i == 0) m_ce = ew1 + 15;
281
282   i = z1 % 2;
283   if (i == 1) m_cn = 0
284   else m_cn = 5;
285
286   i = nw1;
287   while (i-20 >= 0) i = i-20;
288   m_cn = m_cn + i;
289   if (m_cn > 19) m_cn = m_cn - 20;
290
291   raster = zone + m_east.charAt(m_ce) + m_north.charAt(m_cn);
292   return;
293}
294
295function mgr2utm(raster,ew2,nw2)
296{
297/* Copyright (c) 2006, HELMUT H. HEIMEIER
298   Permission is hereby granted, free of charge, to any person obtaining a
299   copy of this software and associated documentation files (the "Software"),
300   to deal in the Software without restriction, including without limitation
301   the rights to use, copy, modify, merge, publish, distribute, sublicense,
302   and/or sell copies of the Software, and to permit persons to whom the
303   Software is furnished to do so, subject to the following conditions:
304   The above copyright notice and this permission notice shall be included
305   in all copies or substantial portions of the Software.*/
306
307/* Die Funktion wandelt militärische UTM Koordinaten (MGR oder
308   UTMREF) in zivile UTM Koordinaten um.
309   UTM Zone zone, raster und utmref müssen gegeben sein.
310   In zone muss die aus 2 Ziffern bestehende Längenzone enthaltens ein
311   gefolgt von der aus einem Buchstaben bestehenden Bandangabe.
312   In raster muss die aus 2 Buchstaben bestehende Kennung für das
313   100 km x 100 km Rasterfeld enthalten sein.
314   In UTMREF muss der 5 stellige Ostwert stehen gefolgt von einem blank
315   und dem 5 stelligen Nordwert.
316   Berechnet wird daraus der 7 stellige Ost- und Nordwert im zivilen
317   UTM System.
318*/
319// Längenzone zone, Ostwert ew und Nordwert nw im WGS84 Datum
320   if (raster == "" || ew2 == "" || nw2 == "")
321   {
322   raster = "";
323   ew2 = "";
324   nw2 = "";
325   return;
326   }
327
328   m_east_0 = "STUVWXYZ";
329   m_east_1 = "ABCDEFGH";
330   m_east_2 = "JKLMNPQR";
331   m_north_0 = "FGHJKLMNPQRSTUVABCDE";
332   m_north_1 = "ABCDEFGHJKLMNPQRSTUV";
333
334   zone = raster.substr(0,3);
335   r_east = raster.substr(3,1);
336   r_north = raster.substr(4,1);
337
338   i = parseInt(raster.substr(0,2)) % 3;
339   if (i == 0) m_ce = m_east_0.indexOf(r_east) + 1;
340   if (i == 1) m_ce = m_east_1.indexOf(r_east) + 1;
341   if (i == 2) m_ce = m_east_2.indexOf(r_east) + 1;
342   ew = "0" + m_ce + ew2;
343
344   i = parseInt(raster.substr(0,2)) % 2;
345   if (i == 0)
346      m_cn = m_north_0.indexOf(r_north)
347   else
348      m_cn = m_north_1.indexOf(r_north);
349
350   band = raster.substr(2,1);
351   if (band >= "N"){
352      if (band == "Q" && m_cn < 10)
353         m_cn = m_cn + 20;
354      if (band >= "R")
355         m_cn = m_cn + 20;
356      if (band == "S" && m_cn < 30)
357         m_cn = m_cn + 20;
358      if (band >= "T")
359         m_cn = m_cn + 20;
360      if (band == "U" && m_cn < 50)
361         m_cn = m_cn + 20;
362      }
363   else {
364      if (band == "C" && m_cn < 10)
365         m_cn = m_cn + 20;
366      if (band >= "D")
367         m_cn = m_cn + 20;
368      if (band == "F" && m_cn < 30)
369         m_cn = m_cn + 20;
370      if (band >= "G")
371         m_cn = m_cn + 20;
372      if (band == "H" && m_cn < 50)
373         m_cn = m_cn + 20;
374      if (band >= "J")
375         m_cn = m_cn + 20;
376      if (band == "K" && m_cn < 70)
377         m_cn = m_cn + 20;
378      if (band >= "L")
379         m_cn = m_cn + 20;
380   }
381
382   if (m_cn.length == 1)
383      nw = "0" + m_cn + nw2
384   else
385      nw = "" + m_cn + nw2;
386return;
387}
388
389function geo2gk(lp, bp)
390{
391/* Copyright (c) 2006, HELMUT H. HEIMEIER
392   Permission is hereby granted, free of charge, to any person obtaining a
393   copy of this software and associated documentation files (the "Software"),
394   to deal in the Software without restriction, including without limitation
395   the rights to use, copy, modify, merge, publish, distribute, sublicense,
396   and/or sell copies of the Software, and to permit persons to whom the
397   Software is furnished to do so, subject to the following conditions:
398   The above copyright notice and this permission notice shall be included
399   in all copies or substantial portions of the Software.*/
400
401/* Die Funktion wandelt geographische Koordinaten in GK Koordinaten
402   um. Geographische Länge lp und Breite bp müssen im Potsdam Datum
403   gegeben sein. Berechnet werden Rechtswert rw und Hochwert hw.
404*/
405// Geographische Länge lp und Breite bp im Potsdam Datum
406   if (lp == "" || bp == "")
407   {
408   rw = "";
409   hw = "";
410   return;
411   }
412   lp = parseFloat(lp);
413   bp = parseFloat(bp);
414
415// Grenzen des Gauss-Krüger-Systems für Deutschland 46° N < bp < 55° N,
416//                                                   5° E < lp < 16° E
417   if (bp < 46 || bp > 56 || lp < 5 || lp > 16)
418   {
419   alert("Werte außerhalb des für Deutschland definierten\n"+
420   " Gauss-Krüger-Systems 5° E < LP < 16° E, 46° N < BP < 55° N");
421   rw = "";
422   hw = "";
423   return;
424   }
425
426// Potsdam Datum
427// Große Halbachse a und Abplattung f
428   a = 6377397.155;
429   f = 3.34277321e-3;
430   pi = Math.PI;
431
432// Polkrümmungshalbmesser c
433   c = a/(1-f);
434
435// Quadrat der zweiten numerischen Exzentrizität
436   ex2 = (2*f-f*f)/((1-f)*(1-f));
437   ex4 = ex2*ex2;
438   ex6 = ex4*ex2;
439   ex8 = ex4*ex4;
440
441// Koeffizienten zur Berechnung der Meridianbogenlänge
442   e0 = c*(pi/180)*(1 - 3*ex2/4 + 45*ex4/64 - 175*ex6/256 + 11025*ex8/16384);
443   e2 = c*(  - 3*ex2/8 + 15*ex4/32  - 525*ex6/1024 +  2205*ex8/4096);
444   e4 = c*(15*ex4/256 - 105*ex6/1024 +  2205*ex8/16384);
445   e6 = c*( -  35*ex6/3072 +   315*ex8/12288);
446
447// Breite in Radianten
448   br = bp * pi/180;
449
450   tan1 = Math.tan(br);
451   tan2 = tan1*tan1;
452   tan4 = tan2*tan2;
453
454   cos1 = Math.cos(br);
455   cos2 = cos1*cos1;
456   cos4 = cos2*cos2;
457   cos3 = cos2*cos1;
458   cos5 = cos4*cos1;
459
460   etasq = ex2*cos2;
461
462// Querkrümmungshalbmesser nd
463   nd = c/Math.sqrt(1 + etasq);
464
465// Meridianbogenlänge g aus gegebener geographischer Breite bp
466   g = e0*bp + e2*Math.sin(2*br) + e4*Math.sin(4*br) + e6*Math.sin(6*br);
467
468// Längendifferenz dl zum Bezugsmeridian lh
469   kz = parseInt((lp+1.5)/3);
470   lh = kz*3;
471   dl = (lp - lh)*pi/180;
472   dl2 = dl*dl;
473   dl4 = dl2*dl2;
474   dl3 = dl2*dl;
475   dl5 = dl4*dl;
476
477// Hochwert hw und Rechtswert rw als Funktion von geographischer Breite und Länge
478   hw = (g + nd*cos2*tan1*dl2/2 + nd*cos4*tan1*(5-tan2+9*etasq)*dl4/24);
479   rw =      (nd*cos1*dl         + nd*cos3*(1-tan2+etasq)*dl3/6 +
480              nd*cos5*(5-18*tan2+tan4)*dl5/120 + kz*1e6 + 500000);
481
482   nk = hw - parseInt(hw);
483   if (nk < 0.5) hw = parseInt(hw)
484   else hw = parseInt(hw) + 1;
485
486   nk = rw - parseInt(rw);
487   if (nk < 0.5) rw = parseInt(rw)
488   else rw = parseInt(rw+1);
489   return;
490}
491
492function gk2geo(rw, hw)
493{
494/* Copyright (c) 2006, HELMUT H. HEIMEIER
495   Permission is hereby granted, free of charge, to any person obtaining a
496   copy of this software and associated documentation files (the "Software"),
497   to deal in the Software without restriction, including without limitation
498   the rights to use, copy, modify, merge, publish, distribute, sublicense,
499   and/or sell copies of the Software, and to permit persons to whom the
500   Software is furnished to do so, subject to the following conditions:
501   The above copyright notice and this permission notice shall be included
502   in all copies or substantial portions of the Software.*/
503
504/* Die Funktion wandelt GK Koordinaten in geographische Koordinaten
505   um. Rechtswert rw und Hochwert hw müssen gegeben sein.
506   Berechnet werden geographische Länge lp und Breite bp
507   im Potsdam Datum.
508*/
509// Rechtswert rw und Hochwert hw im Potsdam Datum
510   if (rw == "" || hw == "")
511   {
512   lp = "";
513   bp = "";
514   return;
515   }
516   rw = parseFloat(rw);
517   hw = parseFloat(hw);
518
519//  Potsdam Datum
520// Große Halbachse a und Abplattung f
521   a = 6377397.155;
522   f = 3.34277321e-3;
523   pi = Math.PI;
524
525// Polkrümmungshalbmesser c
526   c = a/(1-f);
527
528// Quadrat der zweiten numerischen Exzentrizität
529   ex2 = (2*f-f*f)/((1-f)*(1-f));
530   ex4 = ex2*ex2;
531   ex6 = ex4*ex2;
532   ex8 = ex4*ex4;
533
534// Koeffizienten zur Berechnung der geographischen Breite aus gegebener
535// Meridianbogenlänge
536   e0 = c*(pi/180)*(1 - 3*ex2/4 + 45*ex4/64 - 175*ex6/256 + 11025*ex8/16384);
537   f2 =   (180/pi)*(    3*ex2/8 - 3*ex4/16  + 213*ex6/2048 -  255*ex8/4096);
538   f4 =              (180/pi)*(  21*ex4/256 -  21*ex6/256  +  533*ex8/8192);
539   f6 =                           (180/pi)*(  151*ex6/6144 -  453*ex8/12288);
540
541// Geographische Breite bf zur Meridianbogenlänge gf = hw
542   sigma = hw/e0;
543   sigmr = sigma*pi/180;
544   bf = sigma + f2*Math.sin(2*sigmr) + f4*Math.sin(4*sigmr)
545      + f6*Math.sin(6*sigmr);
546
547// Breite bf in Radianten
548   br = bf * pi/180;
549   tan1 = Math.tan(br);
550   tan2 = tan1*tan1;
551   tan4 = tan2*tan2;
552
553   cos1 = Math.cos(br);
554   cos2 = cos1*cos1;
555
556   etasq = ex2*cos2;
557
558// Querkrümmungshalbmesser nd
559   nd = c/Math.sqrt(1 + etasq);
560   nd2 = nd*nd;
561   nd4 = nd2*nd2;
562   nd6 = nd4*nd2;
563   nd3 = nd2*nd;
564   nd5 = nd4*nd;
565
566//  Längendifferenz dl zum Bezugsmeridian lh
567   kz = parseInt(rw/1e6);
568   lh = kz*3
569   dy = rw-(kz*1e6+500000);
570   dy2 = dy*dy;
571   dy4 = dy2*dy2;
572   dy3 = dy2*dy;
573   dy5 = dy4*dy;
574   dy6 = dy3*dy3;
575
576   b2 = - tan1*(1+etasq)/(2*nd2);
577   b4 =   tan1*(5+3*tan2+6*etasq*(1-tan2))/(24*nd4);
578   b6 = - tan1*(61+90*tan2+45*tan4)/(720*nd6);
579
580   l1 =   1/(nd*cos1);
581   l3 = - (1+2*tan2+etasq)/(6*nd3*cos1);
582   l5 =   (5+28*tan2+24*tan4)/(120*nd5*cos1);
583
584// Geographischer Breite bp und Länge lp als Funktion von Rechts- und Hochwert
585   bp = bf + (180/pi) * (b2*dy2 + b4*dy4 + b6*dy6);
586   lp = lh + (180/pi) * (l1*dy  + l3*dy3 + l5*dy5);
587
588   if (lp < 5 || lp > 16 || bp < 46 || bp > 56)
589   {
590   alert("RW und/oder HW ungültig für das deutsche Gauss-Krüger-System");
591   lp = "";
592   bp = "";
593   }
594   var h = new Object();
595   h['lp'] = lp;
596   h['bp'] = bp;
597   return h;
598}
599
600function wgs2pot(lw, bw)
601{
602/* Copyright (c) 2006, HELMUT H. HEIMEIER
603   Permission is hereby granted, free of charge, to any person obtaining a
604   copy of this software and associated documentation files (the "Software"),
605   to deal in the Software without restriction, including without limitation
606   the rights to use, copy, modify, merge, publish, distribute, sublicense,
607   and/or sell copies of the Software, and to permit persons to whom the
608   Software is furnished to do so, subject to the following conditions:
609   The above copyright notice and this permission notice shall be included
610   in all copies or substantial portions of the Software.*/
611
612/* Die Funktion verschiebt das Kartenbezugssystem (map datum) vom
613   WGS84 Datum (World Geodetic System 84) zum in Deutschland
614   gebräuchlichen Potsdam-Datum. Geographische Länge lw und Breite
615   bw gemessen in grad auf dem WGS84 Ellipsoid müssen
616   gegeben sein. Ausgegeben werden geographische Länge lp
617   und Breite bp (in grad) auf dem Bessel-Ellipsoid.
618   Bei der Transformation werden die Ellipsoidachsen parallel
619   verschoben um dx = -587 m, dy = -16 m und dz = -393 m.
620*/
621// Geographische Länge lw und Breite bw im WGS84 Datum
622   if (lw == "" || bw == "")
623   {
624   lp = "";
625   bp = "";
626   return;
627   }
628   lw = parseFloat(lw);
629   bw = parseFloat(bw);
630
631// Quellsystem WGS84 Datum
632// Große Halbachse a und Abplattung fq
633   a = 6378137.000;
634   fq = 3.35281066e-3;
635
636// Zielsystem Potsdam Datum
637// Abplattung f
638   f = fq - 1.003748e-5
639
640// Parameter für datum shift
641   dx = -587;
642   dy = -16;
643   dz = -393;
644
645// Quadrat der ersten numerischen Exzentrizität in Quell- und Zielsystem
646   e2q = (2*fq-fq*fq);
647   e2 = (2*f-f*f);
648
649// Breite und Länge in Radianten
650   pi = Math.PI;
651   b1 = bw * (pi/180);
652   l1 = lw * (pi/180);
653
654// Querkrümmungshalbmesser nd
655   nd = a/Math.sqrt(1 - e2q*Math.sin(b1)*Math.sin(b1));
656
657// Kartesische Koordinaten des Quellsystems WGS84
658   xw = nd*Math.cos(b1)*Math.cos(l1);
659   yw = nd*Math.cos(b1)*Math.sin(l1);
660   zw = (1 - e2q)*nd*Math.sin(b1);
661
662//  Kartesische Koordinaten des Zielsystems (datum shift) Potsdam
663   x = xw + dx;
664   y = yw + dy;
665   z = zw + dz;
666
667// Berechnung von Breite und Länge im Zielsystem
668   rb = Math.sqrt(x*x + y*y);
669   b2 = (180/pi) * Math.atan((z/rb)/(1-e2));
670
671   if (x > 0)
672     l2 = (180/pi) * Math.atan(y/x);
673   if (x < 0 && y > 0)
674     l2 = (180/pi) * Math.atan(y/x) + 180;
675   if (x < 0 && y < 0)
676     l2 = (180/pi) * Math.atan(y/x) - 180;
677
678   lp = l2;
679   bp = b2;
680
681   if (lp < 5 || lp > 16 || bp < 46 || bp > 56)
682   {
683   lp = "";
684   bp = "";
685   }
686   return;
687}
688
689function pot2wgs(lp, bp)
690{
691/* Copyright (c) 2006, HELMUT H. HEIMEIER
692   Permission is hereby granted, free of charge, to any person obtaining a
693   copy of this software and associated documentation files (the "Software"),
694   to deal in the Software without restriction, including without limitation
695   the rights to use, copy, modify, merge, publish, distribute, sublicense,
696   and/or sell copies of the Software, and to permit persons to whom the
697   Software is furnished to do so, subject to the following conditions:
698   The above copyright notice and this permission notice shall be included
699   in all copies or substantial portions of the Software.*/
700
701/* Die Funktion verschiebt das Kartenbezugssystem (map datum) vom in
702   Deutschland gebräuchlichen Potsdam-Datum zum WGS84 (World Geodetic
703   System 84) Datum. Geographische Länge lp und Breite bp gemessen in
704   grad auf dem Bessel-Ellipsoid müssen gegeben sein.
705   Ausgegeben werden geographische Länge lw und
706   Breite bw (in grad) auf dem WGS84-Ellipsoid.
707   Bei der Transformation werden die Ellipsoidachsen parallel
708   verschoben um dx = 587 m, dy = 16 m und dz = 393 m.
709*/
710// Geographische Länge lp und Breite bp im Potsdam Datum
711   if (lp == "" || bp == "")
712   {
713   lw = "";
714   bw = "";
715   return;
716   }
717
718   lp = parseFloat(lp);
719   bp = parseFloat(bp);
720
721// Quellsystem Potsdam Datum
722//  Große Halbachse a und Abplattung fq
723   a = 6378137.000 - 739.845;
724   fq = 3.35281066e-3 - 1.003748e-05;
725
726// Zielsystem WGS84 Datum
727//  Abplattung f
728   f = 3.35281066e-3;
729
730// Parameter für datum shift
731   dx = 587;
732   dy = 16;
733   dz = 393;
734
735// Quadrat der ersten numerischen Exzentrizität in Quell- und Zielsystem
736   e2q = (2*fq-fq*fq);
737   e2 = (2*f-f*f);
738
739// Breite und Länge in Radianten
740   pi = Math.PI;
741   b1 = bp * (pi/180);
742   l1 = lp * (pi/180);
743
744// Querkrümmungshalbmesser nd
745   nd = a/Math.sqrt(1 - e2q*Math.sin(b1)*Math.sin(b1));
746
747// Kartesische Koordinaten des Quellsystems Potsdam
748   xp = nd*Math.cos(b1)*Math.cos(l1);
749   yp = nd*Math.cos(b1)*Math.sin(l1);
750   zp = (1 - e2q)*nd*Math.sin(b1);
751
752// Kartesische Koordinaten des Zielsystems (datum shift) WGS84
753   x = xp + dx;
754   y = yp + dy;
755   z = zp + dz;
756
757// Berechnung von Breite und Länge im Zielsystem
758   rb = Math.sqrt(x*x + y*y);
759   b2 = (180/pi) * Math.atan((z/rb)/(1-e2));
760
761   if (x > 0)
762     l2 = (180/pi) * Math.atan(y/x);
763   if (x < 0 && y > 0)
764     l2 = (180/pi) * Math.atan(y/x) + 180;
765   if (x < 0 && y < 0)
766     l2 = (180/pi) * Math.atan(y/x) - 180;
767
768   lw = l2;
769   bw = b2;
770   return;
771}

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.