简体   繁体   中英

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.

Using a library function, I got the distance between them. I tried using pythagorean theorem to solve the x and y:

d = distance between 2 coordinates

y = 111.320 * (lat2 - lat1)

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.

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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