2012-02-22 6 views

答えて

0

あなたの質問は多少混乱しますが、エリアと距離は2つの異なるものです。

マップ上の2点間の距離を計算するには、Location.distanceTo関数を使用します。

OverlayItem item = mOverlays.get(index); 

GeoPoint mPoint = item.getPoint(); // get Point of your marker 

Location locationMy = m_MyLocationOverlay.getLastFix(); // get current location 
if (locationMy != null) 
{ 
    Location locationPoint = new Location(locationMy); 
    locationPoint.setLatitude((double)mPoint.getLatitudeE6()/1000000.0f); 
    locationPoint.setLongitude((double)mPoint.getLongitudeE6()/1000000.0f); 
    String str = String.format("%.1f miles", locationMy.distanceTo(locationPoint) * 0.000621371192); // meters to miles 
} 
関連する問題