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
mgrs
stringMGRS 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
degrees
intThis parameter represents the degree component of the degrees, minutes and seconds.
minutes
intThis parameter represents the minute component of the degrees, minutes and seconds.
seconds
doubleThis 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
stringThis 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
DegreesMinutesSecondsThis 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
doubleThe 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
doubleThe 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
doubleThe number of decimal degree to convert.
decimals
intThe 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
FeatureThe 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
FeatureThe feature whose decimal degrees to convert.
decimalPlaces
intThe 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
PointShapeThe 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
PointShapeThe point of decimal degree to convert.
decimals
intThe 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
FeatureThe 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
FeatureThe feature you want to convert.
decimals
intNumber 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
PointShapedecimals
intNumber 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
doubleThis is the from latitude value.
fromLongitude
doubleThis is the from longitude value.
toLatitude
doubleThis is the to latitude value.
toLongitude
doubleThis is the to longitude value.
returningUnit
DistanceUnitThis 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
FeatureThe feature you will measure from.
toPointFeature
FeatureThe feature you will measure to.
returningUnit
DistanceUnitThe 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
PointShapeThe point shape you will measure from.
toPoint
PointShapeThe point shape you will measure to.
returningUnit
DistanceUnitThe 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
doubleThe distance over which you would like to know the change in longitude.
distanceUnit
DistanceUnitThe 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
doubleThe distance over which you would like to know the change in longitude.
distanceUnit
DistanceUnitThe unit the distance is in, such as miles or kilometers.
latitude
doubleThe latitude on the globe that the distance is measured at.
Returns
- double
Double representing the distance.
Remarks
None