function distance(x1, y1, x2, y2) { rx = 6378137; // 赤道半径(m) ry = 6356752.314; // 極半径(m) e2=(rx*rx-ry*ry)/rx/rx; // 離心率 E^2 dx = (x2-x1)*Math.PI/180; // 経度の差をラジアン変換 dy = (y2-y1)*Math.PI/180; // 緯度の差をラジアン変換 my = (y1+y2)/2.0*Math.PI/180; // 緯度の平均をラジアン変換 w = Math.sqrt(1-e2*Math.sin(my)*Math.sin(my)); m = rx*(1-e2)/Math.pow(w,3); // 子午線曲率半径 n = rx/w; // 卯酉線曲率半径 return Math.sqrt(Math.pow(dy*m,2) + Math.pow(dx*n*Math.cos(my),2)); } x1 = Number.parseFloat(process.argv[2]); y1 = Number.parseFloat(process.argv[3]); x2 = Number.parseFloat(process.argv[4]); y2 = Number.parseFloat(process.argv[5]); console.log(y2) if (y2) { console.log(distance(x1, y1, x2, y2)); }