xrspatial.proximity.great_circle_distance

xrspatial.proximity.great_circle_distance(x1: float, x2: float, y1: float, y2: float, radius: float = 6378137)float[source]

Calculates great-circle (orthodromic/spherical) distance between (x1, y1) and (x2, y2), assuming each point is a longitude, latitude pair.

x1: float (between -180 and 180)

x-coordinate (latitude) of the first point.

x2: float (between -180 and 180)

x-coordinate (latitude) of the second point.

y1: float (between -90 and 90)

y-coordinate (longitude) of the first point.

y2: float (between -90 and 90)

y-coordinate (longitude) of the second point.

radius: float (default = 6378137)

Radius of sphere (earth).

distance: float

Great-Circle distance between two points.

Algorithm References: - Wikipedia, Great-circle Distance, https://en.wikipedia.org/wiki/Great-circle_distance#:~:text=The%20great%2Dcircle%20distance%2C%20orthodromic,line%20through%20the%20sphere, Accessed Apr. 22, 2021. # noqa

Imports >>> from xrspatial import great_circle_distance as gcd >>> point_a = (123.2, 82.32) >>> point_b = (178.0, 65.09)

Calculate Euclidean Distance >>> dist = gcd(point_a[0], point_b[0], point_a[1], point_b[1]) >>> print(dist) 2378290.489801402