C# Class Geolocation.GeoCalculator

Various utility methods for calculating geographically-based values
Show file Open project: scottschluer/geolocation

Public Properties

Property Type Description
EarthRadiusInMiles double

Public Methods

Method Description
GetBearing ( Coordinate originCoordinate, Coordinate destinationCoordinate ) : double

Calculates the bearing, in degrees between two Coordinate objects

GetBearing ( double originLatitude, double originLongitude, double destinationLatitude, double destinationLongitude ) : double

Calculates the bearing, in degrees between two geographic points

GetDirection ( Coordinate originCoordinate, Coordinate destinationCoordinate ) : string

Gets the cardinal or ordinal direction from the origin point to the destination point

GetDirection ( double originLatitude, double originLongitude, double destinationLatitude, double destinationLongitude ) : string

Gets the cardinal or ordinal direction from the origin point to the destination point

GetDistance ( Coordinate originCoordinate, Coordinate destinationCoordinate, int decimalPlaces ) : Double

Calculate the distance between two sets of Coordinate objects

GetDistance ( double originLatitude, double originLongitude, double destinationLatitude, double destinationLongitude, int decimalPlaces ) : double

Calculate the distance between two sets of coordinates. The latitude of the origin location in decimal notation The longitude of the origin location in decimal notation The latitude of the destination location in decimal notation The longitude of the destination location in decimal notation The number of decimal places to round the return value to A Double value representing the distance in miles from the origin to the destination coordinate

Method Details

GetBearing() public static method

Calculates the bearing, in degrees between two Coordinate objects
public static GetBearing ( Coordinate originCoordinate, Coordinate destinationCoordinate ) : double
originCoordinate Coordinate A object representing the origin location
destinationCoordinate Coordinate A object representing the destination location
return double

GetBearing() public static method

Calculates the bearing, in degrees between two geographic points
public static GetBearing ( double originLatitude, double originLongitude, double destinationLatitude, double destinationLongitude ) : double
originLatitude double The latitude of the origin location in decimal notation
originLongitude double The longitude of the origin location in decimal notation
destinationLatitude double The latitude of the destination location in decimal notation
destinationLongitude double The longitude of the destination location in decimal notation
return double

GetDirection() public static method

Gets the cardinal or ordinal direction from the origin point to the destination point
public static GetDirection ( Coordinate originCoordinate, Coordinate destinationCoordinate ) : string
originCoordinate Coordinate A object representing the origin location
destinationCoordinate Coordinate A object representing the destination location
return string

GetDirection() public static method

Gets the cardinal or ordinal direction from the origin point to the destination point
public static GetDirection ( double originLatitude, double originLongitude, double destinationLatitude, double destinationLongitude ) : string
originLatitude double The latitude of the origin location in decimal notation
originLongitude double The longitude of the origin location in decimal notation
destinationLatitude double The latitude of the destination location in decimal notation
destinationLongitude double The longitude of the destination location in decimal notation
return string

GetDistance() public static method

Calculate the distance between two sets of Coordinate objects
public static GetDistance ( Coordinate originCoordinate, Coordinate destinationCoordinate, int decimalPlaces ) : Double
originCoordinate Coordinate A object representing the origin location
destinationCoordinate Coordinate A object representing the destination location
decimalPlaces int The number of decimal places to round the return value to
return Double

GetDistance() public static method

Calculate the distance between two sets of coordinates. The latitude of the origin location in decimal notation The longitude of the origin location in decimal notation The latitude of the destination location in decimal notation The longitude of the destination location in decimal notation The number of decimal places to round the return value to A Double value representing the distance in miles from the origin to the destination coordinate
public static GetDistance ( double originLatitude, double originLongitude, double destinationLatitude, double destinationLongitude, int decimalPlaces ) : double
originLatitude double
originLongitude double
destinationLatitude double
destinationLongitude double
decimalPlaces int
return double

Property Details

EarthRadiusInMiles public static property

Radius of the earth in miles
public static double EarthRadiusInMiles
return double