# Delphi Function DD°MM.mmm to DD.dddddd°

Hi !

I've been looking for some time now to get this figured out.

I have these two coordinates from a GPS Output :

(DD°MM.mmm)

3844.6793,N,00325.1856,W

I want them both converted to DD.dddddd°

Does anyone have a good function in DELPHI for this ?

e.g. for use as :

Edit1.text := convert(00325.1856,W)

Thanks !

With kind regards,

Paul
###### Who is Participating?

x
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.

Commented:

Just to confirm
So if you run this
Edit1.text := convert(00325.1856,W)

What should the result be?
0
Oracle dbaCommented:
you may want to check the delphiforfun website
it has a demo about long/lat conversion

http://www.delphiforfun.org/programs/MercatorDemo.htm
0
Author Commented:
ewangoya:

38.744655 := convert(3844.6793,N)

For the 00325.1856,W i have no idea what the converted value is,
it's negative, thats all i know, hence my question :)

I don't care if the result is a String or Extended.

Thanks !

Paul
0
Commented:

Use this formular
``````uses
Math;

function ConvertDMToD(const Degrees, Minutes: Integer): Real;
begin
if (Degrees + Minutes = 0)   then
Result := 0
else
Result := Degrees * 1.0 + (Minutes / 60.0);
end;
``````
0
Author Commented:
ewangoya:

Could you tell me how to use that with this as example 00325.1856 ?

I have no clue what the Degrees and minutes are with 00325.1856.

Thanks !

0
Commented:

003 should be DD
25.1856 should be minutes
0
Commented:

Two digits before decimal point are minute
the rest to the left are degrees
seconds are to the right of the decimal
0
Commented:

Also note that corrdinates that are W and S, you add a negative
0
Commented:

so for  00325.1856,W
its evaluated to -3.41976
0

Experts Exchange Solution brought to you by

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

Commented:

I'll give you a library of functions for the conversions later in the day. I'm kind of swamped right now
0
Author Commented:
ewangoya:

I got it working, thanks :)
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
Delphi

From novice to tech pro — start learning today.