我想将GPS位置(纬度,经度)转换为x,y坐标.我找到了许多关于这个主题的链接并应用了它,但它没有给我正确的答案!
我按照这些步骤来测试答案:(1)首先,我采取两个位置并使用地图计算它们之间的距离.(2)然后将两个位置转换为x,y坐标.(3)然后再次计算x,y坐标中两点之间的距离,看它是否在点(1)给出了相同的结果.
我发现以下解决方案之一,但它没有给我正确的答案!
latitude = Math.PI * latitude / 180;
longitude = Math.PI * longitude / 180;
// adjust position by radians
latitude -= 1.570795765134; // subtract 90 degrees (in radians)
// and switch z and y
xPos = (app.radius) * Math.sin(latitude) * Math.cos(longitude);
zPos = (app.radius) * Math.sin(latitude) * Math.sin(longitude);
yPos = (app.radius) * Math.cos(latitude);
Run Code Online (Sandbox Code Playgroud)
我也试过这个链接,但仍然不能与我合作!
任何帮助如何从(纬度,经度)转换为(x,y)?
谢谢,