Pairwise geodesic distances

Hi there,

I cannot seem to find the function for simply calculating the great-circle distance between two geo-coordinates. In the end I am interested in calculating pairwise distances of multiple coordinates (to further apply clustering algorithms). Is there an efficient way of calculating pairwise great-circle distances (within GMT or even pygmt)?

As a workaround I was thinking to use mapproject and calculate the distance from one point to “the line” the remaining points span. Would this be the way to go?

Many thanks for your help, Christopher

For distance been lon1,lat1 and lon2,lat2 you can run

echo lon1 lat1 | gmt mapproejct -Glon2/lat2+uunit


echo 0 0 | gmt mapproject -G5/5+uk
0 0 784.024973654