简体   繁体   English

将两点之间的经度,纬度转换为x,y坐标

[英]Convert latitude, longitude between two points to x,y coordinates

I'm sorry to ask this question as it's been answered several times. 由于这个问题已经被回答了好几次了,我很抱歉提出这个问题。 I read over many of them, but I'm still having trouble drawing the connection to my case. 我仔细阅读了其中的许多内容,但是在绘制与案子的联系时仍然遇到困难。

I have two coordinates in latitude and longitude, and I need to map them onto an xy plane (in meters), with one of them being the origin. 我有两个经度和纬度坐标,我需要将它们映射到xy平面(以米为单位),其中一个是原点。

Using a library function, I got the distance between them. 使用库函数,我得到了它们之间的距离。 I tried using pythagorean theorem to solve the x and y: 我尝试使用毕达哥拉斯定理求解x和y:

d = distance between 2 coordinates d = 2个坐标之间的距离

y = 111.320 * (lat2 - lat1) y = 111.320 *(lat2-lat1)

x = sqrt(d^2 - y^2) x = sqrt(d ^ 2-y ^ 2)

The problem is this is not very accurate, as 111.320 is an average in km and the distance between lat2 and lat1 is in meters (often less than 10) which badly skews the result. 问题是这不是很准确,因为111.320是平均值(以km为单位),而lat2和lat1之间的距离以米为单位(通常小于10),这会严重影响结果。

Are there more accurate ways to do this? 有更准确的方法可以做到这一点吗? Any help would be appreciated. 任何帮助,将不胜感激。

如果纬度差不大,则可以将此近似值用于沿平行线的距离:

dx = 111.111 * (lon2 - lon1) * Cos(AverageLatitude)

you can use a simple implementation of the transverese mercator projection with sub-millimeter precision. 您可以使用跨毫米墨卡托投影的简单实现方式,精度达到亚毫米。 just adjust the longitude of origin and false northing and easting against your needs. 只需根据您的需要调整原点的经度和虚假的北移和东移。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM