API Documentation

spherical_geometry.vector Module

The spherical_geometry.vector module contains the basic operations for handling vectors and converting them to and from other representations.

Functions

two_d(vec)

Reshape a one dimensional vector so it has a second dimension

lonlat_to_vector(lon, lat[, degrees])

Converts a location on the unit sphere from longitude and latitude to an x, y, z vector.

vector_to_lonlat(x, y, z[, degrees])

Converts a vector to longitude and latitude.

normalize_vector(xyz[, output])

Normalizes a vector so it falls on the unit sphere.

radec_to_vector(lon, lat[, degrees])

Converts a location on the unit sphere from longitude and latitude to an x, y, z vector.

vector_to_radec(x, y, z[, degrees])

Converts a vector to longitude and latitude.

rotate_around(x, y, z, u, v, w, theta[, degrees])

Rotates the vector (x, y, z) around the arbitrary axis defined by vector (u, v, w) by theta.

spherical_geometry.great_circle_arc Module

The spherical_geometry.great_circle_arc module contains functions for computing the length, intersection, angle and midpoint of great circle arcs.

Great circles are circles on the unit sphere whose center is coincident with the center of the sphere. Great circle arcs are the section of those circles between two points on the unit sphere.

Functions

angle(A, B, C)

Returns the angle at B between AB and BC.

interpolate(A, B[, steps])

Interpolate along the great circle arc.

intersection(A, B, C, D)

Returns the point of intersection between two great circle arcs.

intersects(A, B, C, D)

Returns True if the great circle arcs between AB and CD intersect.

intersects_point(A, B, C)

Returns True if point C is along the great circle arc AB.

length(A, B)

Returns the angular distance between two points (in vector space) on the unit sphere.

midpoint(A, B)

Returns the midpoint on the great circle arc between A and B.

spherical_geometry.polygon Module

The spherical_geometry.polygon module defines the SphericalPolygon class for managing polygons on the unit sphere.

Classes

SingleSphericalPolygon(points[, inside])

Polygons are represented by both a set of points (in Cartesian (x, y, z) normalized on the unit sphere), and an inside point.

SphericalPolygon(init[, inside])

Polygons are represented by both a set of points (in Cartesian (x, y, z) normalized on the unit sphere), and an inside point.

MalformedPolygonError

spherical_geometry.graph Module

This contains the code that does the actual unioning of regions.

Classes

Graph(polygons)

A graph of nodes connected by edges.