API reference#

Geography properties#

Functions that provide access to properties of Geography objects without side-effects (except for prepare and destroy_prepared).

GeographyType

The enumeration of Geography types.

is_geography(obj, /)

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

get_dimension(geography, /)

Returns the inherent dimensionality of a geography.

get_type_id(geography, /)

Returns the type ID of a geography.

is_empty(geography, /)

Returns True if the geography object is empty, False otherwise.

get_x(geography, /)

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

get_y(geography, /)

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#

Functions that build new Geography objects from coordinates or existing geographies.

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, oriented])

Create a POLYGON geography.

create_multipolygon(polygons)

Create a MULTIPOLYGON geography.

create_collection(geographies)

Create a GEOMETRYCOLLECTION geography from arbitrary geographies.

Input/Output#

Functions that convert Geography objects to/from an external format such as WKT.

from_wkt(geography, /, *[, oriented, ...])

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

to_wkt(geography, /[, precision])

Returns the WKT representation of each geography.

from_wkb(geography, /, *[, oriented, ...])

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

to_wkb(geography, /)

Returns the WKB representation of each geography.

from_geoarrow(geographies, /, *[, oriented, ...])

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

to_geoarrow(geographies, /, *[, ...])

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

Measurement#

Functions that compute measurements of one or more geographies.

area(geography, /[, radius])

Calculate the area of the geography.

distance(a, b[, radius])

Calculate the distance between two geographies.

length(geography, /[, radius])

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

perimeter(geography, /[, radius])

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

Predicates#

Functions that return True or False for some spatial relationship between two geographies.

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)#

Functions that generate a new geography based on the combination of two geographies.

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#

Functions that generate a new geography based on input.

centroid(geography, /)

Computes the centroid of each geography.

boundary(geography, /)

Computes the boundary of each geography.

convex_hull(geography, /)

Computes the convex hull of each geography.