2017-04-13 11 views
-1

android ecillipseプロジェクトの2つの場所間の距離を見つける方法& php。このプロジェクトはオンラインの良質な輸送システムに基づいています。運送業者の運賃は、ソース&間の距離を求める必要がある領域で地図上の2つの場所の距離を見つける方法

+0

Location.distanceBetween( startLatitude、 startLongitude、 endLatitude、 endLongitude、 結果)このコードを試してください。 –

答えて

0
float[] results = new float[1]; 
Location.distanceBetween(source.latitude, source.longitude, 
        destination.latitude, destination.longitude, 
        results); 

を最短車両を見つけるため.Harversine式が実施された宛先は、二つの 位置間のメートルでのおおよその距離を計算し、最初と最後を任意 ショアのベアリングそれらの間のテストパス。距離と方位は、 WGS84楕円体を使用して定義されます。計算された距離は結果[0]に格納されます。結果の長さが 2以上の場合、初期ベアリングは結果[1]に格納されます。結果に の長さが3以上の場合、最終的なベアリングは結果[2]に格納されます。

@param startLatitude the starting latitude 
    @param startLongitude the starting longitude 
    @param endLatitude the ending latitude 
    @param endLongitude the ending longitude 
    @param results an array of floats to hold the results 

    @throws IllegalArgumentException if results is null or has length < 1 
0

double _distance = Location.distanceBetween(
       _firstLatitude, 
       _firstLongitude, 
       _secondLatitude, 
       _secondLongitude, 
       _results); 
関連する問題