pyufunc.calc_distance_on_unit_sphere#
- pyufunc.calc_distance_on_unit_sphere(pt1, pt2, unit='km')#
Calculate the distance between two points on the unit sphere.
- Parameters:
- Returns:
the distance between two points on the unit sphere, or None if an error occurs
- Return type:
float | None
Example
>>> from shapely.geometry import Point >>> pt1 = Point(-0.1276474, 51.5073219) >>> pt2 = Point(-1.9026911, 52.4796992) >>> calc_distance_on_unit_sphere(pt1, pt2) 162.66049633957005
Note
- This function is modified from the original code available at:
- It assumes the earth is perfectly spherical and returns the distance
based on each point’s longitude and latitude.