Hi, the following script should help to do what you want. Searching the web will reveal similar tools. Please be aware that the earth radius may be not accurate enough for some purposes. Best, Martin \can mode verify ! find the great circle distance between 2 points using the law of cosines ! 4 input arguments specify the (decimal) latitudes/longitudes of the points ! arg1=latitude 1 ! arg2=longitude 1 (pos E) ! arg3=latitude 2 ! arg4=longitude 2 (pos (E) let pd=4*atan(1)/180 let rearth=6371.2 ! radius of the earth in km ! latitude must start from N pole (textbook law of cosines) let latt1=90-$1 let latt2=90-$3 ! convert spherical to Cartesian coordinates let x1=sin(pd*latt1)*cos(pd*$2) let y1=sin(pd*latt1)*sin(pd*$2) let z1=cos(pd*latt1) let x2=sin(pd*latt2)*cos(pd*$4) let y2=sin(pd*latt2)*sin(pd*$4) let z2=cos(pd*latt2) let d1=(((x1 - x2)^2) + ((y1 - y2)^2)) + ((z1 - z2)^2) let angle=acos(1-d1/2) ! angular distance between the points let distance=rearth*angle ! distance on the sphere !say `distance` km set mode verify Am 29.03.2017 um 15:10 schrieb Osinski,
Robert FORNATL, PL:
|