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
RaC-NLAsked:
Who is Participating?
 
Ephraim WangoyaConnect With a Mentor Commented:

so for  00325.1856,W
its evaluated to -3.41976
0
 
Ephraim WangoyaCommented:

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

What should the result be?
0
 
Geert GOracle 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
Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
RaC-NLAuthor Commented:
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
0
 
Ephraim WangoyaCommented:

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

0
 
RaC-NLAuthor 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
 
Ephraim WangoyaCommented:


003 should be DD
25.1856 should be minutes
0
 
Ephraim WangoyaCommented:

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

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


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

I got it working, thanks :)
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.