Re: How to Integer to degree,minute,second conversion...

From: Jon Parmet (jon_at_parmetpc.volpe.dot.gov)
Date: 10/29/04


Date: 29 Oct 2004 11:33:18 -0700

tomujtaba@hotmail.com (Mujtaba) wrote in message news:<8f4f92aa.0410282304.555bff38@posting.google.com>...
> Hi
>
> i am working on a software where i am working with latitude,
> longitude. I am reading input from XML file where data is in integer
> format like 408739, -11154
> etc for latitude and longitude etc. Now i have to process it in
> degree, minute and second format.
>
> Simple is that i want to convert integer(not decimal) to degree,
> minute, second. Could anybody plz help me out. Any formula or method.
>
> Thanks in advance...
>
> Mujtaba

There are at least a dozen or more different ways I can think of, but
here's one:

Through the clever use of the 'modulo' operator and the way division
works on integers (e.g. remainder is chucked in the bit bucket), you
can code up an algorithm which 'peels' from the right one component at
a time (e.g. secs first,then mins, then degs.).

Regards,
Jon



Relevant Pages