![85b231f2204a5ab1dae4d26527c14357.png](https://i-blog.csdnimg.cn/blog_migrate/6062cc734380f43668f825b26708b96f.png)
空间权重矩阵的那些事(八)-球面距离权重矩阵
前段时间有人向我咨询了根据经纬度计算球面距离的方法,希望我出一篇文章,所以就有了这篇文章。必要文件可通过后台回复 「地理经纬度」获取。
我首先想到的是matlab的「jplv7」工具箱里的「distance」函数,下面是具体的程序内容:
function D = distance(xc,yc)
% PURPOSE: Computes the list of pairwise distances for a given set of locations (loc).
% ----------------------------------------------------------
% Usage: D = distance(xc,yc)
% where: xc,yc are vectors of latt-long coordinates for each location
% ----------------------------------------------------------
% Returns: D = (n x n)-matrix of pairwise distances
% Written by: TONY E. SMITH, 2/10/98
n = length(xc) ; %number of locations
% Start procedure.
X