添加距离到GPS坐标 [英] Adding distance to a GPS coordinate

查看:250
本文介绍了添加距离到GPS坐标的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图用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.

    这篇关于添加距离到GPS坐标的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆