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