/[projects]/dao/DaoAdresseVedligehold/src/main/java/dk/daoas/adressevedligehold/afstandandenrute/GeoPointHelper.java
ViewVC logotype

Diff of /dao/DaoAdresseVedligehold/src/main/java/dk/daoas/adressevedligehold/afstandandenrute/GeoPointHelper.java

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 2878 by torben, Sat Jan 30 14:05:53 2016 UTC revision 2948 by torben, Sat Feb 13 15:56:00 2016 UTC
# Line 7  import dk.daoas.adressevedligehold.beans Line 7  import dk.daoas.adressevedligehold.beans
7  public class GeoPointHelper {  public class GeoPointHelper {
8    
9    
           
         // Latitude (horizonal), longitude(vertical) so  
         // 1 degree latitude is ~ 111320 meters, since the distance between the  
         // horizonal lines is always the same  
         // 1 degree longitude is ~111320 meters at equator but gets shorter as we  
         // get closer to the poles.  
         // so 1 degree longitude is 64.5 km at denmarks southern point  
         // (gedser=54.55,11.95)  
         // and is 59.4km at northern point (skagen = 57.75,10.65)  
   
         public static double kmToLatitude(double km) {  
                 return km / 111.320;  
         }  
   
         public static double kmToLongitude(double km) {// denne er kun ca  
                 return km / 62.0;  
         }  
           
 ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////  
   
10          /* ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: */          /* ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: */
11          /* :: This function converts decimal degrees to radians : */          /* :: This function converts decimal degrees to radians : */
12          /* ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: */          /* ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: */
13          private static double deg2rad(double deg) {          private static double deg2rad(double deg) {
14                  return (deg * Math.PI / 180.0);                  return deg * Math.PI / 180.0;
15          }          }
16    
17          /* ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: */          /* ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: */
18          /* :: This function converts radians to decimal degrees : */          /* :: This function converts radians to decimal degrees : */
19          /* ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: */          /* ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: */
20          private static double rad2deg(double rad) {          private static double rad2deg(double rad) {
21                  return (rad * 180 / Math.PI);                  return rad * 180 / Math.PI;
22          }          }
23    
24          // http://www.geodatasource.com/developers/java          // http://www.geodatasource.com/developers/java
# Line 54  public class GeoPointHelper { Line 34  public class GeoPointHelper {
34    
35                  // indtil nu er dist i miles - så vi omregner lige til km                  // indtil nu er dist i miles - så vi omregner lige til km
36                  dist = dist * 1.609344;                  dist = dist * 1.609344;
37                  return (dist);                  return dist;
38          }          }
39    
40          public static double beregnAfstand(Address p1, Address p2) {          public static double beregnAfstand(Address p1, Address p2) {

Legend:
Removed from v.2878  
changed lines
  Added in v.2948

  ViewVC Help
Powered by ViewVC 1.1.20