Table of Contents

Class DecimalDegreesHelper

Namespace
ThinkGeo.Core
Assembly
ThinkGeo.Core.dll

This class contains a static routine for converting between degree-minute-second measurement and decimal degree measurement. In essense, it is a routine for converting from a non-decimal degree unit to decimal degree unit distance.

public static class DecimalDegreesHelper
Inheritance
DecimalDegreesHelper
Inherited Members

Methods

ConvertFromMgrs(string)

Convert the MGRS string to latitude and longitude

public static PointShape ConvertFromMgrs(string mgrs)

Parameters

mgrs string

MGRS string

Returns

PointShape

The converted coordinate.

ConvertToMgrs(double, double)

Convert the input latitude and longitude to MGRS string

public static string ConvertToMgrs(double latitude, double longitude)

Parameters

latitude double

Latitude coordinate.

longitude double

Longitude coordinate.

Returns

string

The MGRS corresponding to input latitude and longitude.

GetDecimalDegreeFromDegreesMinutesSeconds(int, int, double)

This method returns a decimal degree value based on a set of degrees, minutes, and seconds.

public static double GetDecimalDegreeFromDegreesMinutesSeconds(int degrees, int minutes, double seconds)

Parameters

degrees int

This parameter represents the degree component of the degrees, minutes and seconds.

minutes int

This parameter represents the minute component of the degrees, minutes and seconds.

seconds double

This parameter represents the second component of the degrees, minutes and seconds.

Returns

double

This method returns a decimal degree value based on a set of degrees, minutes, and seconds.

Remarks

If you pass in 75, 21 and 28, the result passed back will be 75.2577777778.

GetDecimalDegreeFromDegreesMinutesSeconds(string)

This method returns a decimal degree value based on a string containing degrees, minutes, and seconds.

public static double GetDecimalDegreeFromDegreesMinutesSeconds(string degreesMinutesSeconds)

Parameters

degreesMinutesSeconds string

This parameter represents the degrees, minutes and seconds in a string.

Returns

double

This method returns a decimal degree value based on a string containing degrees, minutes, and seconds.

Remarks

If you pass in "75?21' 28''" as a string, then the result will be 75.35777777784.

GetDecimalDegreeFromDegreesMinutesSeconds(DegreesMinutesSeconds)

This method returns a decimal degree value based on a degree, minute and second structure.

public static double GetDecimalDegreeFromDegreesMinutesSeconds(DegreesMinutesSeconds degreesMinutesSeconds)

Parameters

degreesMinutesSeconds DegreesMinutesSeconds

This structure represents the degrees, minutes and seconds.

Returns

double

This method returns a decimal degree value based on a degree, minute and second structure.

Remarks

If you pass in 75, 21 and 28, the result passed back will be 75.2577777778.

GetDegreesMinutesSecondsFromDecimalDegree(double)

This method returns a degrees, minutes and seconds structure from a decimal degree value.

public static DegreesMinutesSeconds GetDegreesMinutesSecondsFromDecimalDegree(double decimalDegreesValue)

Parameters

decimalDegreesValue double

The decimal degree value you want to convert.

Returns

DegreesMinutesSeconds

This method returns a degrees, minutes and seconds structure from a decimal degree value.

Remarks

The method allows you pass in a decimal degree number and return the degree, minute, second as variables passed in on the method call.

GetDegreesMinutesSecondsStringFromDecimalDegree(double)

This method returns a string representation in degrees, minutes and seconds from a decimal degree value.

public static string GetDegreesMinutesSecondsStringFromDecimalDegree(double decimalDegreesValue)

Parameters

decimalDegreesValue double

The number of decimal degrees to convert.

Returns

string

This method returns a string representation in degrees, minutes and seconds from a decimal degree value.

Remarks

Example: If you enter 75.358 as the number of decimal degrees, the result would be 75 degrees, 21 minutes, 28 seconds. Thus, the return string would be 75?21' 28".

GetDegreesMinutesSecondsStringFromDecimalDegree(double, int)

This method returns a string representation in degrees, minutes and seconds from a decimal degree value and a specified precision.

public static string GetDegreesMinutesSecondsStringFromDecimalDegree(double decimalDegreesValue, int decimals)

Parameters

decimalDegreesValue double

The number of decimal degree to convert.

decimals int

The number of float decision for the second.

Returns

string

This method returns a string representation in degrees, minutes and seconds from a decimal degree value.

Remarks

Example: If you enter 75.358 as the number of decimal degree and 12 as decimals, the result would be 75 degrees, 21 minutes, 28.80000000015 seconds. Thus, the return string would be 75?21' 28.80000000015".

GetDegreesMinutesSecondsStringFromDecimalDegreePoint(Feature)

This method returns a string representation in degrees, minutes and seconds from a decimal degree value.

public static string GetDegreesMinutesSecondsStringFromDecimalDegreePoint(Feature point)

Parameters

point Feature

The feature whose decimal degrees to convert.

Returns

string

This method returns a string representation in degrees, minutes and seconds from a decimal degree value.

Remarks

None

GetDegreesMinutesSecondsStringFromDecimalDegreePoint(Feature, int)

This method returns a string representation in degrees, minutes and seconds from a decimal degree value.

public static string GetDegreesMinutesSecondsStringFromDecimalDegreePoint(Feature point, int decimalPlaces)

Parameters

point Feature

The feature whose decimal degrees to convert.

decimalPlaces int

The number of decimal degree to convert.

Returns

string

This method returns a string representation in degrees, minutes and seconds from a decimal degree value.

Remarks

None

GetDegreesMinutesSecondsStringFromDecimalDegreePoint(PointShape)

This method returns a string representation in degrees, minutes and seconds from a decimal degree value.

public static string GetDegreesMinutesSecondsStringFromDecimalDegreePoint(PointShape pointShape)

Parameters

pointShape PointShape

The point you want to convert.

Returns

string

This method returns a string representation in degrees, minutes and seconds from a decimal degree value.

Remarks

Passing in a point will return the point's location represented in degrees, minutes, and seconds. For example, if the point's location in decimal degrees is (75.358, 36.345), the actual returned string would be "75?21' 29''E 36?20' 42''N".

GetDegreesMinutesSecondsStringFromDecimalDegreePoint(PointShape, int)

This method returns a string representation in degrees, minutes and seconds from a decimal degree value.

public static string GetDegreesMinutesSecondsStringFromDecimalDegreePoint(PointShape pointShape, int decimals)

Parameters

pointShape PointShape

The point of decimal degree to convert.

decimals int

The number of decimal degree to convert.

Returns

string

This method returns a string representation in degrees, minutes and seconds from a decimal degree value.

Remarks

None

GetDegreesMinutesStringFromDecimalDegreePoint(Feature)

This method returns a string representation in degrees and minutes from a decimal degree point.

public static string GetDegreesMinutesStringFromDecimalDegreePoint(Feature point)

Parameters

point Feature

The point you want to convert.

Returns

string

This method returns a string representation in degrees and minutes from a decimal degree point.

GetDegreesMinutesStringFromDecimalDegreePoint(Feature, int)

This method returns a string representation in degrees and minutes from a decimal degree point.

public static string GetDegreesMinutesStringFromDecimalDegreePoint(Feature point, int decimals)

Parameters

point Feature

The feature you want to convert.

decimals int

Number of decimals for the Minutes value

Returns

string

This method returns a string representation in degrees and minutes from a decimal degree point.

GetDegreesMinutesStringFromDecimalDegreePoint(PointShape)

This method returns a string representation in degrees and minutes from a decimal degree point.

public static string GetDegreesMinutesStringFromDecimalDegreePoint(PointShape pointShape)

Parameters

pointShape PointShape

Returns

string

This method returns a string representation in degrees and minutes from a decimal degree point.

GetDegreesMinutesStringFromDecimalDegreePoint(PointShape, int)

This method returns a string representation in degrees and minutes from a decimal degree point.

public static string GetDegreesMinutesStringFromDecimalDegreePoint(PointShape pointShape, int decimals)

Parameters

pointShape PointShape
decimals int

Number of decimals for the Minutes value

Returns

string

This method returns a string representation in degrees and minutes from a decimal degree point.

GetDistanceFromDecimalDegrees(double, double, double, double, DistanceUnit)

This method returns the distance between two decimal degree points.

public static double GetDistanceFromDecimalDegrees(double fromLatitude, double fromLongitude, double toLatitude, double toLongitude, DistanceUnit returningUnit)

Parameters

fromLatitude double

This is the from latitude value.

fromLongitude double

This is the from longitude value.

toLatitude double

This is the to latitude value.

toLongitude double

This is the to longitude value.

returningUnit DistanceUnit

This is the distance unit you would like to use in the return value. For example, if you select miles as your returningUnit, then the distance will be returned in miles.

Returns

double

This method returns the distance between two decimal degree points in the unit specified by the returningUnit parameter.

Remarks

None

GetDistanceFromDecimalDegrees(Feature, Feature, DistanceUnit)

This method returns the distance between two decimal degree points.

public static double GetDistanceFromDecimalDegrees(Feature fromPointFeature, Feature toPointFeature, DistanceUnit returningUnit)

Parameters

fromPointFeature Feature

The feature you will measure from.

toPointFeature Feature

The feature you will measure to.

returningUnit DistanceUnit

The unit you would like your results back in, such as miles or kilometers.

Returns

double

This method returns the distance between two decimal degree points in the unit specified by the returningUnit parameter.

Remarks

None

GetDistanceFromDecimalDegrees(PointShape, PointShape, DistanceUnit)

This method returns the distance between two decimal degree points.

public static double GetDistanceFromDecimalDegrees(PointShape fromPoint, PointShape toPoint, DistanceUnit returningUnit)

Parameters

fromPoint PointShape

The point shape you will measure from.

toPoint PointShape

The point shape you will measure to.

returningUnit DistanceUnit

The unit you would like your results back in, such as miles or kilometers.

Returns

double

This method returns the distance between two decimal degree points in the unit specified by the returningUnit parameter.

Remarks

None

GetLatitudeDifferenceFromDistance(double, DistanceUnit)

Calculate the amount of longitude change given a certain distance and longitude.

public static double GetLatitudeDifferenceFromDistance(double distance, DistanceUnit distanceUnit)

Parameters

distance double

The distance over which you would like to know the change in longitude.

distanceUnit DistanceUnit

The unit the distance is in, such as miles or kilometers.

Returns

double

Double representing the distance.

Remarks

None

GetLongitudeDifferenceFromDistance(double, DistanceUnit, double)

Calculate the amount of longitude change given a certain distance and latitude.

public static double GetLongitudeDifferenceFromDistance(double distance, DistanceUnit distanceUnit, double latitude)

Parameters

distance double

The distance over which you would like to know the change in longitude.

distanceUnit DistanceUnit

The unit the distance is in, such as miles or kilometers.

latitude double

The latitude on the globe that the distance is measured at.

Returns

double

Double representing the distance.

Remarks

None