Projektteil 2
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

Deg2UTM.java 3.6KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. package de.edotzlaff.detection.detektion.berechnung.mathObjekte;
  2. public class Deg2UTM {
  3. double Easting;
  4. double Northing;
  5. int Zone;
  6. char Letter;
  7. public Deg2UTM(double Lat, double Lon) {
  8. Zone = (int) Math.floor(Lon / 6 + 31);
  9. if (Lat < -72)
  10. Letter = 'C';
  11. else if (Lat < -64)
  12. Letter = 'D';
  13. else if (Lat < -56)
  14. Letter = 'E';
  15. else if (Lat < -48)
  16. Letter = 'F';
  17. else if (Lat < -40)
  18. Letter = 'G';
  19. else if (Lat < -32)
  20. Letter = 'H';
  21. else if (Lat < -24)
  22. Letter = 'J';
  23. else if (Lat < -16)
  24. Letter = 'K';
  25. else if (Lat < -8)
  26. Letter = 'L';
  27. else if (Lat < 0)
  28. Letter = 'M';
  29. else if (Lat < 8)
  30. Letter = 'N';
  31. else if (Lat < 16)
  32. Letter = 'P';
  33. else if (Lat < 24)
  34. Letter = 'Q';
  35. else if (Lat < 32)
  36. Letter = 'R';
  37. else if (Lat < 40)
  38. Letter = 'S';
  39. else if (Lat < 48)
  40. Letter = 'T';
  41. else if (Lat < 56)
  42. Letter = 'U';
  43. else if (Lat < 64)
  44. Letter = 'V';
  45. else if (Lat < 72)
  46. Letter = 'W';
  47. else
  48. Letter = 'X';
  49. Easting = 0.5 * Math.log((1 + Math.cos(Lat * Math.PI / 180) * Math.sin(Lon * Math.PI / 180 - (6 * Zone - 183) * Math.PI / 180)) / (1 - Math.cos(Lat * Math.PI / 180) * Math.sin(Lon * Math.PI / 180 - (6 * Zone - 183) * Math.PI / 180))) * 0.9996 * 6399593.62 / Math.pow((1 + Math.pow(0.0820944379, 2) * Math.pow(Math.cos(Lat * Math.PI / 180), 2)), 0.5) * (1 + Math.pow(0.0820944379, 2) / 2 * Math.pow((0.5 * Math.log((1 + Math.cos(Lat * Math.PI / 180) * Math.sin(Lon * Math.PI / 180 - (6 * Zone - 183) * Math.PI / 180)) / (1 - Math.cos(Lat * Math.PI / 180) * Math.sin(Lon * Math.PI / 180 - (6 * Zone - 183) * Math.PI / 180)))), 2) * Math.pow(Math.cos(Lat * Math.PI / 180), 2) / 3) + 500000;
  50. Easting = Math.round(Easting * 100) * 0.01;
  51. Northing = (Math.atan(Math.tan(Lat * Math.PI / 180) / Math.cos((Lon * Math.PI / 180 - (6 * Zone - 183) * Math.PI / 180))) - Lat * Math.PI / 180) * 0.9996 * 6399593.625 / Math.sqrt(1 + 0.006739496742 * Math.pow(Math.cos(Lat * Math.PI / 180), 2)) * (1 + 0.006739496742 / 2 * Math.pow(0.5 * Math.log((1 + Math.cos(Lat * Math.PI / 180) * Math.sin((Lon * Math.PI / 180 - (6 * Zone - 183) * Math.PI / 180))) / (1 - Math.cos(Lat * Math.PI / 180) * Math.sin((Lon * Math.PI / 180 - (6 * Zone - 183) * Math.PI / 180)))), 2) * Math.pow(Math.cos(Lat * Math.PI / 180), 2)) + 0.9996 * 6399593.625 * (Lat * Math.PI / 180 - 0.005054622556 * (Lat * Math.PI / 180 + Math.sin(2 * Lat * Math.PI / 180) / 2) + 4.258201531e-05 * (3 * (Lat * Math.PI / 180 + Math.sin(2 * Lat * Math.PI / 180) / 2) + Math.sin(2 * Lat * Math.PI / 180) * Math.pow(Math.cos(Lat * Math.PI / 180), 2)) / 4 - 1.674057895e-07 * (5 * (3 * (Lat * Math.PI / 180 + Math.sin(2 * Lat * Math.PI / 180) / 2) + Math.sin(2 * Lat * Math.PI / 180) * Math.pow(Math.cos(Lat * Math.PI / 180), 2)) / 4 + Math.sin(2 * Lat * Math.PI / 180) * Math.pow(Math.cos(Lat * Math.PI / 180), 2) * Math.pow(Math.cos(Lat * Math.PI / 180), 2)) / 3);
  52. if (Letter < 'M')
  53. Northing = Northing + 10000000;
  54. Northing = Math.round(Northing * 100) * 0.01;
  55. }
  56. public double getEasting() {
  57. return Easting;
  58. }
  59. public void setEasting(double easting) {
  60. Easting = easting;
  61. }
  62. public double getNorthing() {
  63. return Northing;
  64. }
  65. public void setNorthing(double northing) {
  66. Northing = northing;
  67. }
  68. }