title: How to calculate the angle of the direction from two GPS coordinates
body: <p>i have found a great way to calculate the angle of the direction from two coordinates, and i have tried the solution in excel, it worked fine when i typed the approximately coordinates. But if i implement the code in java, i got complately different results at dxy (angle) double variables. The coordinates are fine, i double checked them. :)</p>
  
  <pre><code>    double lon1 = (double)Math.round(LongitudeDouble * 1000000) / 1000000;
      double lat1 = (double)Math.round(LatitudeDouble * 1000000) / 1000000;
  
      double lon2 = 19.055954;
      double lat2 = 47.569331;
  
      ***************************
  
      double dy = (lat2 - lat1);
      double dx = Math.cos(Math.PI/180*lat1)*(lon2-lon1);
  
      double dxy = Math.atan2(dy, dx);
      double degree = 180/Math.PI*dxy;
  </code></pre>