Class DecimalDegreesHelper
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
mgrsstringMGRS 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
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
degreesintThis parameter represents the degree component of the degrees, minutes and seconds.
minutesintThis parameter represents the minute component of the degrees, minutes and seconds.
secondsdoubleThis 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
degreesMinutesSecondsstringThis 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
degreesMinutesSecondsDegreesMinutesSecondsThis 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
decimalDegreesValuedoubleThe 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
decimalDegreesValuedoubleThe 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
decimalDegreesValuedoubleThe number of decimal degree to convert.
decimalsintThe 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
pointFeatureThe 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
pointFeatureThe feature whose decimal degrees to convert.
decimalPlacesintThe 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
pointShapePointShapeThe 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
pointShapePointShapeThe point of decimal degree to convert.
decimalsintThe 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
pointFeatureThe 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
pointFeatureThe feature you want to convert.
decimalsintNumber 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
pointShapePointShape
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
pointShapePointShapedecimalsintNumber 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
fromLatitudedoubleThis is the from latitude value.
fromLongitudedoubleThis is the from longitude value.
toLatitudedoubleThis is the to latitude value.
toLongitudedoubleThis is the to longitude value.
returningUnitDistanceUnitThis 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
fromPointFeatureFeatureThe feature you will measure from.
toPointFeatureFeatureThe feature you will measure to.
returningUnitDistanceUnitThe 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
fromPointPointShapeThe point shape you will measure from.
toPointPointShapeThe point shape you will measure to.
returningUnitDistanceUnitThe 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
distancedoubleThe distance over which you would like to know the change in longitude.
distanceUnitDistanceUnitThe 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
distancedoubleThe distance over which you would like to know the change in longitude.
distanceUnitDistanceUnitThe unit the distance is in, such as miles or kilometers.
latitudedoubleThe latitude on the globe that the distance is measured at.
Returns
- double
Double representing the distance.
Remarks
None