[Python-ideas] Geo coordinates conversion in stdlib

Andrew Barnert abarnert at yahoo.com
Sun Mar 22 23:37:51 CET 2015


On Mar 22, 2015, at 2:38 PM, Antoine Pitrou <solipsis at pitrou.net> wrote:
> 
> On Sun, 22 Mar 2015 17:15:39 -0400
> Alexander Walters
> <tritium-list at sdamon.com> wrote:
>>> On 3/21/2015 05:46, anatoly techtonik wrote:
>>> I think it should be in stdlib.
>>> 
>>> 11° 18′ 0″ S, 2° 42′ 0″ E   to  -11.3, 2.7  and back.
>>> 
>>> This is from Wikipedia.
>> Why does this need to be in the standard library?
> 
> Because Anatoly needs it, of course :)

Well, it would certainly be nice to have all of Wikipedia in the stdlib, but I wonder how that would affect Python's release schedule, and its use in resource-constrained systems.

More seriously, if you're just looking to convert arcminutes and arcseconds to and from fractional degrees, it's exactly the same algorithm as converting minutes and seconds to fractional hours, which we already have in the datetime.timedelta class. If you can't figure out the complexity of multiplying and divmodding by 60 twice, you can borrow its code, or just wrap it and delegate. That seems trivial enough to do in any project that needs it. And that means projects that want degrees-arcminutes-arcseconds-milliarcseconds (e.g., for astronomy) or just degrees and fractional arcminutes with no arcseconds (e.g., for marine navigation) or degrees, arcminutes, and eighth-arcminutes (e.g., for US military scopes) can just as easily get what they need, instead of being forced to use the variation surveyors prefer. 


More information about the Python-ideas mailing list