## com.TwentyCodes.android.SkyHook
Class GeoUtils

    java.lang.Object
      com.TwentyCodes.android.SkyHook.GeoUtils

    public class GeoUtils

extends Object

This class contains common tools for computing common geological problems

Author:
  ricky barrette, Google Inc.

Field Summary
`private static int` `EARTH_RADIUS_KM`
`static int` `maxLatitude`
`static int` `maxLongitude`
`static double` `MILLION`
`static int` `minLatitude`
`static int` `minLongitude`

Constructor Summary
`GeoUtils()`

Method Summary
`static double` `bearing(double lat1, double lon1, double lat2, double lon2)` computes the bearing of lat2/lon2 in relationship from lat1/lon1 in degrees East
`static double` `bearing(GeoPoint p1, GeoPoint p2)` computes the bearing of lat2/lon2 in relationship from lat1/lon1 in degrees East
`static GeoPoint` `distanceFrom(GeoPoint point, double distance)` Calculates a geopoint x meters away of the geopoint supplied.
`static double` `distanceKm(double lat1, double lon1, double lat2, double lon2)` computes the distance between to lat1/lon1 and lat2/lon2 based on the curve of the earth
`static double` `distanceKm(GeoPoint p1, GeoPoint p2)` computes the distance between to p1 and p2 based on the curve of the earth
`static GeoPoint` `midPoint(GeoPoint p1, GeoPoint p2)` computes a geopoint the is the central geopoint between p1 and p1
`static double` `radToBearing(double rad)` converts radians to bearing

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### EARTH_RADIUS_KM

    private static int EARTH_RADIUS_KM

### MILLION

    public static double MILLION

### minLatitude

    public static int minLatitude

### maxLatitude

    public static int maxLatitude

### minLongitude

    public static int minLongitude

### maxLongitude

    public static int maxLongitude

Constructor Detail

### GeoUtils

    public GeoUtils()

Method Detail

### bearing

    public static double bearing(double lat1,
                                 double lon1,
                                 double lat2,
                                 double lon2)

  computes the bearing of lat2/lon2 in relationship from lat1/lon1 in degrees East

  Parameters:
    `lat1` - source lat
    `lon1` - source lon
    `lat2` - destination lat
    `lon2` - destination lon
  Returns:
    the bearing of lat2/lon2 in relationship from lat1/lon1 in degrees East

### bearing

    public static double bearing(GeoPoint p1,
                                 GeoPoint p2)

  computes the bearing of lat2/lon2 in relationship from lat1/lon1 in degrees East

  Parameters:
    `p1` - source geopoint
    `p2` - destination geopoint
  Returns:
    the bearing of p2 in relationship from p1 in degrees East

### distanceFrom

    public static GeoPoint distanceFrom(GeoPoint point,
                                        double distance)

  Calculates a geopoint x meters away of the geopoint supplied. The new geopoint shares the same latitude as geopoint point, this way they are on the same latitude arc.

  Parameters:
    `point` - central geopoint
    `distance` - in meters from the geopoint
  Returns:
    geopoint that is x meters away from the geopoint supplied

### distanceKm

    public static double distanceKm(double lat1,
                                    double lon1,
                                    double lat2,
                                    double lon2)

  computes the distance between to lat1/lon1 and lat2/lon2 based on the curve of the earth

  Parameters:
    `lat1` - source lat
    `lon1` - source lon
    `lat2` - destination lat
    `lon2` - destination lon
  Returns:
    the distance between to lat1/lon1 and lat2/lon2

### distanceKm

    public static double distanceKm(GeoPoint p1,
                                    GeoPoint p2)

  computes the distance between to p1 and p2 based on the curve of the earth

  Parameters:
    `p1` -
    `p2` -
  Returns:
    the distance between to p1 and p2

### midPoint

    public static GeoPoint midPoint(GeoPoint p1,
                                    GeoPoint p2)

  computes a geopoint the is the central geopoint between p1 and p1

  Parameters:
    `p1` - first geopoint
    `p2` - second geopoint
  Returns:
    the central geopoint

### radToBearing

    public static double radToBearing(double rad)

  converts radians to bearing

  Parameters:
    `rad` -
  Returns:
    bearing