已知一点的经纬度和该点到另一点的距离,求另一点的经纬度

刚做了将经纬度转换成距离,现在又要弄将距离转换成经纬度,哎!伤不起啊!

以下是将距离换算成经纬度,有误差。 

           //将相对于起点的距离转换为经纬度,distance代表到点的距离,angle代表方位角度
        private string ConvertDistanceToLogLat(float distance, string logLatPtStr, double angle)
        {
            string logLat = null;
            string[] temp_Arrary = logLatPtStr.Split(',');
            double lng1 = ConvertLongiToDouble(temp_Arrary[0].Replace("(",""));
            double lat1 = ConvertLongiToDouble(temp_Arrary[1].Replace(")",""));
            double lon = lng1 + (distance * Math.Sin(angle* Math.PI / 180)) / (111 * Math.Cos(lat1 * Math.PI / 180));//将距离转换成经度的计算公式
            double lat = lat1 + (distance * Math.Cos(angle* Math.PI / 180)) / 111;//将距离转换成纬度的计算公式
            string logStr = ConvertLogLatToString(lon);
            string latStr = ConvertLogLatToString(lat);
            logLat = "(" + logStr + "," + latStr + ")";
            return logLat;
        }


        //将double值转换成度分秒字符串
        private string ConvertLogLatToString(double lon)
        {
            string resut = null;

            string temp = lon.ToString();
            string[] du = temp.Split('.');
            resut += du[0] + "°";
            double fen = (lon - Convert.ToDouble(du[0])) * 60;
            string[] fen_Arrary = fen.ToString().Split('.');
            resut += fen_Arrary[0] + "′";
            if (fen_Arrary.Length > 1)
            {
                double second = Math.Round((fen - Convert.ToDouble(fen_Arrary[0])) * 60, 0);
                resut += second.ToString() + "″";
            }
            return resut;
        }

 

你可能感兴趣的:(纬度)