1
我畫喜歡這一行,路線中途點
,我已經使用下面的代碼中找到中間點,
public void midPoint(double lat1,double lon1,double lat2,double lon2){
double dLon = Math.toRadians(lon2 - lon1);
lat1 = Math.toRadians(lat1);
lat2 = Math.toRadians(lat2);
lon1 = Math.toRadians(lon1);
double Bx = Math.cos(lat2) * Math.cos(dLon);
double By = Math.cos(lat2) * Math.sin(dLon);
finalLat= Math.toDegrees(Math.atan2(Math.sin(lat1) + Math.sin(lat2), Math.sqrt((Math.cos(lat1) + Bx) * (Math.cos(lat1) + Bx) + By * By)));
finalLng= Math.toDegrees(lon1 + Math.atan2(By, Math.cos(lat1) + Bx));
}
它的成功合作..
但我無法找到「R」 - 路線半途點。如何在android上找到路線中途點。我在網上搜索過,發現了https://gis.stackexchange.com/questions/18584/how-to-find-a-point-half-way-between-two-other-points。但在這種方法中,爲x,y,z分配了什麼值..我不知道。
或任何其他代碼在Android上查找路線的一半。
你在你的問題中提到的鏈接,只是爲了得到兩拉特長的確切中點。不適用於地圖方向。所以我建議你用其他方式來尋找它。 – user370305 2012-08-10 07:38:49
如果可能的話查看Android的任何位置(Place)應用程序,它將使用您需要的相同概念。 – user370305 2012-08-10 07:43:48
另請參閱http://mathforum.org/library/drmath/view/51822.html和http://www.movable-type.co.uk/scripts/latlong.html。 – user370305 2012-08-10 07:48:25