API reference#

Geography properties#

GeographyType

The enumeration of Geography types

is_geography(obj)

Returns True if the object is a Geography, False otherwise.

get_dimensions(geography)

Returns the inherent dimensionality of a geography.

get_type_id(geography)

Returns the type ID of a geography.

get_x(a)

Returns the longitude value of the Point (in degrees).

get_y(a)

Returns the latitude value of the Point (in degrees).

is_prepared(geography)

Returns True if the geography object is "prepared", False otherwise.

prepare(geography)

Prepare a geography, improving performance of other operations.

destroy_prepared(geography)

Destroy the prepared part of a geography, freeing up memory.

Geography creation#

create_point([longitude, latitude])

Create a POINT geography.

create_multipoint(points)

Create a MULTIPOINT geography.

create_linestring([vertices])

Create a LINESTRING geography.

create_multilinestring(lines)

Create a MULTILINESTRING geography.

create_polygon([shell, holes])

Create a POLYGON geography.

create_multipolygon(polygons)

Create a MULTIPOLYGON geography.

create_collection(geographies)

Create a GEOMETRYCOLLECTION geography from arbitrary geographies.

Input/Output#

from_wkt(a[, oriented, planar, ...])

Creates geographies from the Well-Known Text (WKT) representation.

to_wkt(a[, precision])

Returns the WKT representation of each geography.

from_wkb(a[, oriented, planar, ...])

Creates geographies from the Well-Known Bytes (WKB) representation.

to_wkb(a)

Returns the WKB representation of each geography.

from_geoarrow(input, /, *, oriented, planar, ...)

Create an array of geographies from an Arrow array object with a GeoArrow extension type.

to_geoarrow(input, /, *, output_schema, ...)

Convert an array of geographies to an Arrow array object with a GeoArrow extension type.

Projection

Measurement#

area(a[, radius])

Calculate the area of the geography.

distance(a, b[, radius])

Calculate the distance between two geographies.

length(a[, radius])

Calculates the length of a line geography, returning zero for other types.

perimeter(a[, radius])

Calculates the perimeter of a polygon geography, returning zero for other types.

Predicates#

equals(a, b)

Returns True if A and B are spatially equal.

intersects(a, b)

Returns True if A and B share any portion of space.

touches(a, b)

Returns True if A and B intersect, but their interiors do not intersect.

contains(a, b)

Returns True if B is completely inside A.

within(a, b)

Returns True if A is completely inside B.

disjoint(a, b)

Returns True if A boundaries and interior does not intersect at all with those of B.

covers(a, b)

Returns True if every point in B lies inside the interior or boundary of A.

covered_by(a, b)

Returns True if every point in A lies inside the interior or boundary of B.

Overlays (boolean operations)#

union(a, b)

Computes the union of both geographies.

intersection(a, b)

Computes the intersection of both geographies.

difference(a, b)

Computes the difference of both geographies.

symmetric_difference(a, b)

Computes the symmetric difference of both geographies.

Constructive operations#

centroid(a)

Computes the centroid of each geography.

boundary(a)

Computes the boundary of each geography.

convex_hull(a)

Computes the convex hull of each geography.