Convert Lat/Long to degrees

I'm looking for a function to convert Lat / Long to degrees and minutes.

lon   -122.1284680368919
lat   37.76387287100824


 37°45'52.72"N
122° 7'46.53"W

anybody got something like this?

Thanks.

NG,
LVL 13
nike_golfAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Rog DManager Inforamtion SystemsCommented:
Doing a little google I found the following....

Yes it's in Javascript, but maybe you can use this as a basis for what you need to do.

http://javascript.internet.com/math-related/latitude-longitude-converter.html

Rog
0
Mike TomlinsonMiddle School Assistant TeacherCommented:
0
FER_GCommented:
Try to see some of the next examples ...

http://tinyurl.com/2cgtq6
http://tinyurl.com/25t26f

I hope they can help you.
FerG

Saludos.
--
Ing. Fernando D. Giletta
MP: 4035 CIEC
San Fco. Cba. Arg.


0
The Ultimate Tool Kit for Technolgy Solution Provi

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy for valuable how-to assets including sample agreements, checklists, flowcharts, and more!

hbustanCommented:
Check out this link (I'm sure you will like this one):

http://www.tma.dk/gps/
0
GrahamSkanRetiredCommented:

    Dim dda As Double
    Dim d As Integer
    Dim m As Integer
    Dim s As Double
    Dim r As Double
    Dim strLon As String
    Dim sign As Integer
    
    sign = Sgn(dblDegrees)
    dda = Abs(dblDegrees)
    d = Int(Abs(dda))
    r = (dda - d) * 60
    m = Int(r)
    s = (r - m) * 60
    DMS = d & "°" & m & "'" & Format(s, "00.00") & """" & IIf(bLatitude, IIf(sign = -1, "S", "N"), IIf(sign = -1, "W", "E"))

Open in new window

0
GrahamSkanRetiredCommented:
That seems to have missed the Function and End Function
Function DMS(dblDegrees As Double, bLatitude As Boolean) As String
    Dim dda As Double
    Dim d As Integer
    Dim m As Integer
    Dim s As Double
    Dim r As Double
    Dim strLon As String
    Dim sign As Integer
    
    sign = Sgn(dblDegrees)
    dda = Abs(dblDegrees)
    d = Int(Abs(dda))
    r = (dda - d) * 60
    m = Int(r)
    s = (r - m) * 60
    DMS = d & "°" & m & "'" & Format(s, "00.00") & """" & IIf(bLatitude, IIf(sign = -1, "S", "N"), IIf(sign = -1, "W", "E"))
End Function

Open in new window

0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Jaime OlivaresSoftware ArchitectCommented:
Is it VB6 or vb.net, I can provide you a vb.net funcion like:


Public Function FormatCoord(ByVal value As Double, ByVal isLatitude As Boolean) As String 
    Dim deg As Double, min As Double, sec As Double 
    
    Dim gr As Double = Math.Abs(value) 
    deg = CSng(Math.Floor(gr)) 
    gr -= deg 
    min = CSng(Math.Floor(gr / 60F)) 
    sec = gr - min * 60F 
    
    If latitude Then 
        Return String.Format("{0:0#}°{1:0#}'{2:0#.#}""", deg, min, sec) + (IIf(value < 0,"S","N")) 
    Else 
        Return String.Format("{0:0##}°{1:0#}'{2:0#.#}""", deg, min, sec) + (IIf(value < 0,"W","E")) 
    End If 
End Function 

Open in new window

0
Jaime OlivaresSoftware ArchitectCommented:
sorry, typo, at line 10, should be:

     If isLatitude Then
0
nike_golfAuthor Commented:
Wow! thanks for the responses.

Vb6 is the development platform so Java is out.

NG,
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic Classic

From novice to tech pro — start learning today.