2011-03-07 2 views

答えて

2

を確認し、実際の1; Calculate distance, bearing and more between Latitude/Longitude pointsがあります)地理的なデータと異なる計算への素晴らしい参照。そのページを開き、「目的地からの距離と出発点からの方位」の部分に移動すると、数式とオンライン計算機があるので、それらをチェックすることができます(地図上の点も表示されます)。 、あなたは南、北、東と西の矩形の辺の座標を見つける必要があるバインドなので、あなたはパラメータに変更されるすべてが角であり、そして、あなたの場合には、それは0になります見つけること

(lat1,lng1) - your point (marker coordinates) 
d - distance (in your case it would be 2.5km) 
brng - angle.. 

:式は、いくつかのパラメータを持っています90度、180度、270度。式:

var lat2 = Math.asin(Math.sin(lat1)*Math.cos(d/R) + 
         Math.cos(lat1)*Math.sin(d/R)*Math.cos(brng)); 
var lon2 = lon1 + Math.atan2(Math.sin(brng)*Math.sin(d/R)*Math.cos(lat1), 
          Math.cos(d/R)-Math.sin(lat1)*Math.sin(lat2)); 

まあ、角度= 0あなたは北見つけ、PI/2の指定 - (角度はラジアンで渡す必要があります)西 - 東、PI - 南、3 *のPI/2。

R = earth’s radius (mean radius = 6,371km) 

アドオン:私はオンラインフォームベアリングに入るときためだけで、そのページのソースコードを見= 0、2、私は二つの点でマッピングし、地図の縮尺に応じて参照=距離それらの間の距離は実際に2kmです。さて、あなたはどんな保証明示せずに、または黙示、シンプルattributionライセンスの下でこのライブラリを使用することができ、あなたが必要それを含め

<script src="http://www.movable-type.co.uk/scripts/latlon.js"></script> 

機能は次のとおりです。

/** 
* Returns the destination point from this point having travelled the given distance (in km) on the 
* given initial bearing (bearing may vary before destination is reached) 
* 
* see http://williams.best.vwh.net/avform.htm#LL 
* 
* @param {Number} brng: Initial bearing in degrees 
* @param {Number} dist: Distance in km 
* @returns {LatLon} Destination point 
*/ 
LatLon.prototype.destinationPoint = function(brng, dist) { 
dist = typeof(dist)=='number' ? dist : typeof(dist)=='string' && dist.trim()!='' ? +dist : NaN; 
dist = dist/this._radius; // convert dist to angular distance in radians 
brng = brng.toRad(); // 
var lat1 = this._lat.toRad(), lon1 = this._lon.toRad(); 

var lat2 = Math.asin(Math.sin(lat1)*Math.cos(dist) + 
Math.cos(lat1)*Math.sin(dist)*Math.cos(brng)); 
var lon2 = lon1 + Math.atan2(Math.sin(brng)*Math.sin(dist)*Math.cos(lat1), 
Math.cos(dist)-Math.sin(lat1)*Math.sin(lat2)); 
lon2 = (lon2+3*Math.PI)%(2*Math.PI) - Math.PI; // normalise to -180...+180 

return new LatLon(lat2.toDeg(), lon2.toDeg()); 
} 

と私はオンラインフォームベアリングで入力してください= 0、距離= 2、このメソッドは、引数latLonCalc.destinationPoint(0, "2");

私は

間違っているかどうか確認することができるように私に入力パラメータを与えそうでない場合は、それをしようと実行されます

UPDATE2このライブラリはgradsで動作し、計算のためにそれらをラジアンに変換してから再びgradsに変換します。

var latLonCalc = new new LatLon(25, 45); 
var point = latLonCalc.destinationPoint(0, "2"); 
console.info(point); 
// prints 25°01′05″N, 045°00′00″E { _lat=25.01798643211838, _lon=45.00000000000005, _radius=6371} 

そう入口点と最終目的地との間の距離が1分よりも少しである:単純なテストを行います

earth = 2 * PI * 6371; // 40 009.98km 
=> 40 009.98km/360grad =~111.14 
=> 111,14/60 = 1.85 (km/minute) ~2km 

それだった最後のポイントは、その後、遠くのエントリポイントではない、との距離は2キロであることを私に語ったラウンド計算、;)

+0

あなたは、私が上記の式を使用している場合、これは100%正しいと確信していますbrng = 0、距離= 2で2km以上離れたところにwaaayがあります – nokiko

+0

@nokiko:私の答えを更新しました。どうぞご覧ください – Maxym

関連する問題