zoukankan      html  css  js  c++  java
  • 坐标点转换

    看群友讨论顺便记录下。

    #-*- utf-8 -*-
    import math
    #114.29536896,22.67160804 114.29521308,22.67150796 114.29511696,22.67172198 114.29529084,22.67178804 114.29536896,22.67160804
    lis = ["114.29496792,22.67057799 114.29503812,22.67053497 114.29498592,22.67045901 114.29493408,22.67049096 114.29490708,22.67050896 114.29491608,22.67053002 114.294951,22.67057196 114.29496,22.67056503 114.29496792,22.67057799","114.294456,22.66987401 114.29450784,22.66994997 114.29453412,22.66993503 114.29454312,22.66993098 114.29455104,22.66992603 114.29459496,22.66990002 114.29460288,22.66989597 114.29458596,22.66986996 114.29457696,22.66987401 114.29453412,22.66982397 114.29447292,22.66986303 114.294456,22.66987401","114.29463816,22.66994799 114.29461188,22.66990902 114.29460288,22.66991604 114.29452512,22.66996302 114.29456004,22.67001297 114.29454312,22.67001999 114.29456904,22.670046 114.29457696,22.67004204 114.29459496,22.670028 114.29462088,22.67001504 114.29465508,22.669992 114.29466408,22.66998498 114.29463816,22.66994799"]
    for li in lis:
        location = li.split(' ')
        print ("******************************")
        for loc in location:
            lo = loc.split(',')
            lon,lat =  float(lo[0]),float(lo[1])
            lon = lon * math.pi/180
            lat = lat * math.pi/180
            bo = 30 * math.pi/180
            a = 6378137
            b = 6356752.3142
            e = math.sqrt(1- (b / a) * (b / a))
            e2 = math.sqrt((a / b) * (a / b) -1)
            CosB0 = math.cos(bo)
            N = (a * a / b) / math.sqrt(1+ e2 * e2 * CosB0 * CosB0)
            k = N * CosB0
            pi = math.pi
            sinb = math.sin(lat)
            tan = math.tan(pi/4+lat/2)
            E = math.pow((1- e * sinb) / (1+ e * sinb), e /2)
            xx = tan * E
            xc = k * math.log(xx)
            yc = k * lon
            print('['+str(yc) +','+str(xc)+'],')
    
    
  • 相关阅读:
    文章标题
    PAT Basic Level 1006
    PAT Basic Level 1005
    PAT Basic Level 1004
    PAT Basic Level 1036
    PAT Basic Level 1002
    (算法)递归各习题总结反思 *基础
    uvaoj 101
    C语言(关于二级指针)
    普通算法(高效幂运算)
  • 原文地址:https://www.cnblogs.com/c-x-a/p/9837890.html
Copyright © 2011-2022 走看看