Manipulation of geometric/geographical data.

Geometric transformation

Geometric type

transform_geom_point_type(*pts[, as_geom])

Transform iterable to shapely.geometry.Point type, or the other way round.

Coordinate system

wgs84_to_osgb36(longitudes, latitudes[, ...])

Convert latitude and longitude (WGS84) to British national grid (OSGB36).

osgb36_to_wgs84(eastings, northings[, as_array])

Convert British national grid (OSGB36) to latitude and longitude (WGS84).

Dimension / Shape

drop_axis(geom[, axis, as_array])

Drop an axis from a given 3D geometry object.

Geometry calculation


calc_distance_on_unit_sphere(pt1, pt2)

Calculate distance between two points.

calc_hypotenuse_distance(pt1, pt2)

Calculate hypotenuse given two points (the right-angled triangle, given its side and perpendicular).

find_closest_point(pt, ref_pts[, as_geom])

Find the closest point of the given point to a list of points.

find_closest_points(pts, ref_pts[, k, ...])

Find the closest points from a list of reference points (applicable for vectorized computation).


get_midpoint(x1, y1, x2, y2[, as_geom])

Get the midpoint between two points (applicable for vectorized computation).

get_geometric_midpoint(pt1, pt2[, as_geom])

Get the midpoint between two points.

get_geometric_midpoint_calc(pt1, pt2[, as_geom])

Get the midpoint between two points by pure calculation.

get_rectangle_centroid(rectangle[, as_geom])

Get coordinates of the centroid of a rectangle

get_square_vertices(ctr_x, ctr_y, side_length)

Get the four vertices of a square given its centre and side length.

get_square_vertices_calc(ctr_x, ctr_y, ...)

Get the four vertices of a square given its centre and side length (by elementary calculation).

Geometric data visualisation


sketch_square(ctr_x, ctr_y[, side_length, ...])

Sketch a square given its centre point, four vertices and rotation angle (in degree).