添加距离到GPS坐标坐标、距离、GPS

2023-09-12 07:16:55 作者:以后的以后,我们都要幸福

我试图用GPS来产生一些点在不同地方的远离固定点。

I'm trying to generate some points at random distances away from a fixed point using GPS.

我怎样才能在米远处添加到GPS坐标? 我看着UTM全球定位系统转换,但有一个简单的方法来实现这一目标?

How can I add distance in meters to a GPS coordinate? I've looked at UTM to GPS conversion but is there a simpler method to achieve this?

我正在Android平台上,以防万一。

I'm working on Android platform just in case.

干杯, FGS

推荐答案

P0(lat0,lon0):初始位置(单位:度的) DX,DY:从初始位置随机偏移的米的

P0(lat0,lon0) : initial position (unit : degrees) dx,dy : random offsets from your initial position in meters

您可以用近似计算的随机位置的位置:

You can use an approximation to compute the position of the randomized position:

 lat = lat0 + (180/pi)*(dy/6378137)
 lon = lon0 + (180/pi)*(dx/6378137)/cos(lat0)

这是相当precise只要随机距离偏移低于10-100公里

This is quite precise as long as the random distance offset is below 10-100 km

编辑:当然,Java中Math.cos()预计弧度所以不要使用 Math.cos(Math.PI / 180.0 * lat0)如果lat0是度为上述假设。

of course in Java Math.cos() expects radians so do use Math.cos(Math.PI/180.0*lat0) if lat0 is in degrees as assumed above.