L
Lance
Hi all,
Below is a funtion that converts a Lat or Lon coordinate (as a Double) to a
string of Degrees, Minutes and Seconds. It's based on an MS Exmaple for VBA
found here http://support.microsoft.com/?kbid=213449. Do you think this is
this best way to go about it .NET, or could it be done more efficiently?
/////
Private Function ConvertDegrees(ByVal DecimalDegrees As Double) As String
Dim Degrees As Int32 = 0
Dim Minutes As Single = 0
Dim Seconds As Single = 0
Dim DMS As String = ""
Degrees = Fix(DecimalDegrees)
Minutes = (DecimalDegrees - Degrees) * 60
Seconds = (Minutes - Fix(Minutes)) * 60
DMS = System.Math.Abs(Degrees) & Chr(186) & _
" " & Format(System.Math.Abs(Fix(Minutes)), "00") & _
"' " & Format(System.Math.Abs(Seconds), "00.00") & Chr(34)
Return DMS
End Function
/////
Thanks,
Lance
Below is a funtion that converts a Lat or Lon coordinate (as a Double) to a
string of Degrees, Minutes and Seconds. It's based on an MS Exmaple for VBA
found here http://support.microsoft.com/?kbid=213449. Do you think this is
this best way to go about it .NET, or could it be done more efficiently?
/////
Private Function ConvertDegrees(ByVal DecimalDegrees As Double) As String
Dim Degrees As Int32 = 0
Dim Minutes As Single = 0
Dim Seconds As Single = 0
Dim DMS As String = ""
Degrees = Fix(DecimalDegrees)
Minutes = (DecimalDegrees - Degrees) * 60
Seconds = (Minutes - Fix(Minutes)) * 60
DMS = System.Math.Abs(Degrees) & Chr(186) & _
" " & Format(System.Math.Abs(Fix(Minutes)), "00") & _
"' " & Format(System.Math.Abs(Seconds), "00.00") & Chr(34)
Return DMS
End Function
/////
Thanks,
Lance