geo Module

Library for manipulating geographic things.

class geo.Bounds(sw_point, ne_point)[source]

Bases: object

Class to represent a rectangular bounded space on the globe.

contains(pt)[source]
get_area()[source]
get_center()[source]

Calculate reasonable approximation of the midpoint of the bounds.

Returns :

center : Point

Point object that represents the center of the bounds.

get_geocell_grid(resolution)[source]

Gets the grid of geocells that covers this Bounds object.

get_geocells(resolution)[source]

Gets the set of geocells that covers this Bounds object.

nw[source]
se[source]
class geo.Point(lat, lon, deg=True)[source]

Bases: object

Class to represent a latitude, longitude pair.

Notes

Embeds radian values as member objects because most distance methods use radians rather than degrees. A copy of the approx_distance() function is left outside the class to achieve a quick but less accurate calculation of distance without instantiating a point object.

Point distance formulae adapted from and ©2002-2012 Chris Veness. Post titled Calculate distance, bearing and more between Latitude/Longitude points.

approx_distance(pt)[source]

Equirectangular distance approximation formula.

as_tuple()[source]
bearing_to(pt)[source]

Initial bearing / forward azimuth.

destination_point(bearing, distance)[source]

Point along great circle path given bearing and distance away.

distance_to(pt)[source]

Haversine distance formula.

final_bearing_to(pt)[source]
midpoint_to(pt)[source]

Halfway point along a great circle path.

geo.approx_distance((lat1, lon1), (lat2, lon2))[source]

Equirectangular approximation formula without Point objects.

geo.bounds_from_pt_and_distance(pt, distance)[source]

Derive N/S/E/W points at distance length away to compute bounds.

Previous topic

frontend_handler_test Module

Next topic

geo_test Module

This Page