直接上代码。。
import numpy
#从键盘自定义输入扁率,长半轴,椭球高(区域中心高)等
#f=1/(298.257)
f=float(input("f:"))
#a=6378140.0
a=float(input("a:"))
L=0.0
e=2*f-f*f
B=0.0
H=float(input("H:"))
f1=open(r'C:\Users\suns\Desktop\POI1.txt','r')
f2=open(r'C:\Users\suns\Desktop\new.txt','w')
#从文本中读取经纬度转成空间直角坐标X,Y,Z
for i in f1:
st=i.split(',')
L=float(st[0])
B=float(st[1])
n1=e*numpy.math.sin(B/57.29578)
n2=n1*n1
n3=1-n2
n4=numpy.math.sqrt(n3)
n5=a/n4
X=(H+n5)*(numpy.math.cos(B/57.29578)*numpy.math.cos(L/57.29578))
Y=(H+n5)*(numpy.math.cos(B/57.29578)*numpy.math.sin(L/57.29578))
Z=(n5*(1-e*e)+H)*(numpy.math.sin(B/57.29578))
f2.write(str(X)+","+str(Y)+","+str(Z)+"\n")
f1.close()
f2.close()
其实应该要和坐标转换结合起来,有待改进........