Consider two probability distributions $P=\{p_i\}_{i=1}^n$ and $Q=\{q_i\}_{i=1}^n$ so that $p_i\ge 0$ for all $i$, $q_j\ge 0$ for all $j$, and $\sum_i p_i=\sum_j q_j=1$. The optimal transport between $P$ and $Q$ can be expressed as following. $$\widehat{T}=\arg\min_{T} \sum_{i, j=1}^n d_{ij}^2T_{ij} $$ s.t. $$\begin{cases} T_{ij}\ge 0\\ \sum_j T_{ij}=p_i\\ \sum_i T_{ij}=q_j \end{cases}$$ where $d_{ij}$ is the base distance between cell i in $P$ and cell j in $Q$.
If let the cell $i$ in $P$ be $x_i\in R^2$ and cell $j$ in $Q$ be $y_j\in R^2$, then the Euclidean distance is just $$ d_{ij}^2=\|x_i-y_j\|^2 $$
My question is that how about the great distance? If we take the base distance to be the great circle distance between the (longitude, latitude)coordinates, what is the formula of this "great circle distance"? It seems the result is same as the geodesist package in R.