簡體   English   中英

如何從已知位置找到90°方向100m處的坐標(緯度,經度)?

[英]How do I find the coordinates (latitude, longitude) at 100m in 90° direction from a known location?

37.545892,126.978445如何在90°方向100m處找到坐標(緯度,經度)?

找出結論。

public static double[] moveLocation(double latitude, double longitude, double direction, double length){

    double distRadians = length / (6372797.6);

    double rbearing = direction * Math.PI / 180.0;

    double lat1 = latitude * Math.PI / 180;
    double lon1 = longitude * Math.PI / 180;

    double lat2 = Math.asin(Math.sin(lat1) * Math.cos(distRadians) + Math.cos(lat1)
            * Math.sin(distRadians) * Math.cos(rbearing));
    double lon2 = lon1 + Math.atan2(Math.sin(rbearing) * Math.sin(distRadians) * Math.cos(lat1),
            Math.cos(distRadians) - Math.sin(lat1) * Math.sin(lat2));

    lat2 = lat2 * 180 / Math.PI;
    lon2 = lon2 * 180 / Math.PI;

    return new double[]{ lat2, lon2 };

}

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM