upoints - Modules for working with points on Earth.
upoints is a collection of GPL v3 licensed modules for working with points on Earth, or other near spherical objects. It allows you to calculate the distance and bearings between points, mangle xearth/xplanet data files, work with online UK trigpoint databases, NOAA‘s weather station database and other such location databases.
The upoints.point module is the simplest interface available, and is mainly useful as a naïve object for simple calculation and subclassing for specific usage. An example of how to use it follows:
>>> from upoints import point >>> Home = point.Point(52.015, -0.221) >>> Telford = point.Point(52.6333, -2.5000) >>> int(Home.distance(Telford)) 169 >>> int(Home.bearing(Telford)) 294 >>> int(Home.final_bearing(Telford)) 293 >>> import datetime >>> Home.sun_events(datetime.date(2007, 6, 28)) (datetime.time(3, 42), datetime.time(20, 24)) >>> Home.sunrise(datetime.date(2007, 6, 28)) datetime.time(3, 42) >>> Home.sunset(datetime.date(2007, 6, 28)) datetime.time(20, 24)