Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Re: (unknown)

0 views
Skip to first unread message

Gabriel Genellina

unread,
Nov 15, 2009, 11:08:23 AM11/15/09
to pytho...@python.org
En Fri, 13 Nov 2009 16:05:26 -0300, Ronn Ross <ronn...@gmail.com>
escribiᅵ:

> I'm attempting to convert latitude and longitude coordinates from degrees
> minutes and second to decimal form. I would like to go from:
> N39 42 36.3 W77 42 51.5
> to:
> -77.739855,39.706666
>
> Does anyone know of a library or some existing out their to help with
> this
> conversion?

Should be:

decimal = degrees + minutes/60.0 + seconds/3600.0
N,E are positive; S,W are negative.

But the above numbers don't match.

--
Gabriel Genellina

Gabriel Genellina

unread,
Nov 15, 2009, 11:08:23 AM11/15/09
to pytho...@python.org

Tommy Grav

unread,
Nov 16, 2009, 9:11:20 AM11/16/09
to pytho...@python.org

On Nov 15, 2009, at 11:08 AM, Gabriel Genellina wrote:

> En Fri, 13 Nov 2009 16:05:26 -0300, Ronn Ross <ronn...@gmail.com> escribió:
>
>> I'm attempting to convert latitude and longitude coordinates from degrees
>> minutes and second to decimal form. I would like to go from:
>> N39 42 36.3 W77 42 51.5
>> to:
>> -77.739855,39.706666
>>
>> Does anyone know of a library or some existing out their to help with this
>> conversion?
>
> Should be:
>
> decimal = degrees + minutes/60.0 + seconds/3600.0
> N,E are positive; S,W are negative.
>
> But the above numbers don't match.

It is more complicated than that. For negative numbers the value is degrees -minutes/60. - seconds/3600.
And people always trip up on numbers that start with -00 :)

Cheers
Tommy

Gabriel Genellina

unread,
Nov 16, 2009, 11:20:00 AM11/16/09
to pytho...@python.org
En Mon, 16 Nov 2009 11:11:20 -0300, Tommy Grav <tg...@me.com> escribiᅵ:

> On Nov 15, 2009, at 11:08 AM, Gabriel Genellina wrote:

>> En Fri, 13 Nov 2009 16:05:26 -0300, Ronn Ross <ronn...@gmail.com>

>> escribiᅵ:


>>
>>> I'm attempting to convert latitude and longitude coordinates from
>>> degrees
>>> minutes and second to decimal form. I would like to go from:
>>> N39 42 36.3 W77 42 51.5
>>> to:
>>> -77.739855,39.706666
>>

>> decimal = degrees + minutes/60.0 + seconds/3600.0
>> N,E are positive; S,W are negative.
>> But the above numbers don't match.
>
> It is more complicated than that. For negative numbers the value is
> degrees -minutes/60. - seconds/3600.
> And people always trip up on numbers that start with -00 :)

I set the sign of the result *after* computing it, so it doesn't matter.

py> 39 + 42/60.0 + 36.3/3600
39.710083333333337
py> 77 + 42/60.0 + 51.5/3600
77.714305555555555

Either the example above is incorrect, or there is another thing involved.

--
Gabriel Genellina

0 new messages