LoginSignup
0
0

More than 5 years have passed since last update.

個人メモ:緯度経度+方向距離

Posted at

var lat_per_m = 360 / Math.PI / 2 / 6378150;
function latLngAddDirDis(latlon, dir, dis)
{
// 緯線上の移動距離
lat_dis = Math.cos(dir * Math.PI / 180) * dis;
// 緯度の変化量
lat_delta = lat_dis * lat_per_m;
new_lat = latlon.Lat + lat_delta;
// 経線上の移動距離
lon_dis = Math.sin(dir * Math.PI / 180) * dis;
// 1mあたりの経度
lon_per_m = 360 / Math.PI / 2 / 6378150 / Math.cos(new_lat * Math.PI / 180);
// 経度の変化量
lon_delta = lon_dis * lon_per_m;
return new Y.LatLng(new_lat, latlon.Lon + lon_delta);
}

0
0
1

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0