Skip to content

DecimalDegreesHelper

Namespace: ThinkGeo.Core

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 ObjectDecimalDegreesHelper

Methods

GetDegreesMinutesStringFromDecimalDegreePoint(Feature, Int32)

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 Int32
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(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(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, Int32)

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 Int32
Number of decimals for the Minutes value

Returns

String

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

GetDegreesMinutesStringFromDecimalDegree(Double)

internal static string GetDegreesMinutesStringFromDecimalDegree(double decimalDegreesValue)

Parameters

decimalDegreesValue Double

Returns

String

GetDegreesMinutesStringFromDecimalDegree(Double, Int32)

internal static string GetDegreesMinutesStringFromDecimalDegree(double decimalDegreesValue, int decimals)

Parameters

decimalDegreesValue Double

decimals Int32

Returns

String

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, Int32)

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 Int32
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(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, Int32)

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 Int32
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(Feature, Int32)

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 Int32
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(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

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.

GetDecimalDegreeFromDegreesMinutesSeconds(Int32, Int32, 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 Int32

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

minutes Int32

        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.

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

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(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

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

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

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.

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.

GetLatitudeFromDistanceAndDegree(Double, Double, Double, DistanceUnit, Double)

internal static double GetLatitudeFromDistanceAndDegree(double fromLongitude, double fromLatitude, double distance, DistanceUnit distanceUnit, double degree)

Parameters

fromLongitude Double

fromLatitude Double

distance Double

distanceUnit DistanceUnit

degree Double

Returns

Double

GetLongitudeFromDistanceAndDegree(Double, Double, Double, DistanceUnit, Double)

internal static double GetLongitudeFromDistanceAndDegree(double fromLongitude, double fromLatitude, double distance, DistanceUnit distanceUnit, double degree)

Parameters

fromLongitude Double

fromLatitude Double

distance Double

distanceUnit DistanceUnit

degree Double

Returns

Double

GetGreatCircle(PointShape, PointShape, Int32)

internal static MultilineShape GetGreatCircle(PointShape fromPoint, PointShape toPoint, int count)

Parameters

fromPoint PointShape

toPoint PointShape

count Int32

Returns

MultilineShape

GetDistanceFromDecimalDegreesLine(Double, Double, Double, Double, PointShape, DistanceUnit)

internal static double GetDistanceFromDecimalDegreesLine(double fromPointX, double fromPointY, double toPointX, double toPointY, PointShape pointShape, DistanceUnit lengthUnit)

Parameters

fromPointX Double

fromPointY Double

toPointX Double

toPointY Double

pointShape PointShape

lengthUnit DistanceUnit

Returns

Double

GetNearestPointFromPointShapeDecimalDegreesLine(Double, Double, Double, Double, PointShape)

internal static PointShape GetNearestPointFromPointShapeDecimalDegreesLine(double fromPointX, double fromPointY, double toPointX, double toPointY, PointShape pointShape)

Parameters

fromPointX Double

fromPointY Double

toPointX Double

toPointY Double

pointShape PointShape

Returns

PointShape

GetXFromDegreeOnSphere(Double, Double, DistanceUnit)

internal static double GetXFromDegreeOnSphere(double degreeX, double degreeY, DistanceUnit distanceUnit)

Parameters

degreeX Double

degreeY Double

distanceUnit DistanceUnit

Returns

Double

GetYFromDegreeOnSphere(Double, DistanceUnit)

internal static double GetYFromDegreeOnSphere(double degreeY, DistanceUnit distanceUnit)

Parameters

degreeY Double

distanceUnit DistanceUnit

Returns

Double