function dxdydz2ned,xyz1,xyz2 loc=xyz2latlon(xyz1,0) vect=xyz2-xyz1 ;T=dblarr(3,3) ;T[0,0]=-sin(loc[0])*cos(loc[1]) ;T[0,1]=-sin(loc[0])*sin(loc[1]) ;T[0,2]=cos(loc[0]) ;T[1,0]=-sin(loc[1]) ;T[1,1]=cos(loc[1]) ;T[1,2]=0 ;T[2,0]=-cos(loc[0])*cos(loc[1]) ;T[2,1]=-cos(loc[0])*sin(loc[1]) ;T[2,2]=-sin(loc[0]) ;return,invert(T)##vect return,xyz2ned(vect,loc) end