Der Snippet wandelt Längen und Breitengrade in das so genannte sexagesimal Format um.
Beispiel:
ConvertDecimalDegreesToSexagesimal(37,4219720)
ergibt: 37° 25' 1519''
/// <summary>
/// Converts the decimal degrees to sexagesimal.
/// </summary>
/// <param name="decimalValueToConvert">The decimal value to convert.</param>
/// <returns></returns>
private string ConvertDecimalDegreesToSexagesimal(double decimalValueToConvert)
{
int degrees = (int)decimalValueToConvert;
int minutes = (int)((decimalValueToConvert - degrees) * 60);
int seconds = (int)((decimalValueToConvert - degrees - (minutes / 60)) * 3600);
return String.Format("{0}° {1}' {2}''", degrees, minutes, seconds);
}
4 Kommentare zum Snippet