Link to home
Start Free TrialLog in
Avatar of RaC-NL
RaC-NL

asked on

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
Avatar of Ephraim Wangoya
Ephraim Wangoya
Flag of United States of America image


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

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

http://www.delphiforfun.org/programs/MercatorDemo.htm
Avatar of RaC-NL
RaC-NL

ASKER

ewangoya:

For your question :

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

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;

Open in new window

Avatar of RaC-NL

ASKER

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 !



003 should be DD
25.1856 should be minutes

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

Also note that corrdinates that are W and S, you add a negative
ASKER CERTIFIED SOLUTION
Avatar of Ephraim Wangoya
Ephraim Wangoya
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial


I'll give you a library of functions for the conversions later in the day. I'm kind of swamped right now
Avatar of RaC-NL

ASKER

ewangoya:

I got it working, thanks :)