geo_helper.py 文件源码

python
阅读 18 收藏 0 点赞 0 评论 0

项目:toollabs 作者: multichill 项目源码 文件源码
def turn_xyz_into_llh(x,y,z,system):
    """Convert 3D Cartesian x,y,z into Lat, Long and Height
       See http://www.ordnancesurvey.co.uk/gps/docs/convertingcoordinates3D.pdf"""

    a = abe_values[system][0]
    b = abe_values[system][1]
    e2 = abe_values[system][2]

    p = math.sqrt(x*x + y*y)

    long = math.atan(y/x)
    lat_init = math.atan( z / (p * (1.0 - e2)) )
    v = a / math.sqrt( 1.0 - e2 * (math.sin(lat_init) * math.sin(lat_init)) )
    lat = math.atan( (z + e2*v*math.sin(lat_init)) / p )

    height = (p / math.cos(lat)) - v # Ignore if a bit out

    # Turn from radians back into degrees
    long = long / 2 / math.pi * 360
    lat = lat / 2 / math.pi * 360

    return [lat,long,height]
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号