资源简介
python坐标转换程序
代码片段和文件信息
import arcgisscripting os sys math string
gp = arcgisscripting.create()
gp.AddToolbox(“C:/Program Files/ArcGIS/ArcToolbox/Toolboxes/Data Management Tools.tbx“)
p = range(200)
o = range(200)
PI = 3.1415926535897931
x1=range(200)
x2=range(200)
yy1=range(100)
y2=range(200)
b1=range(200)
l1=range(200)
b2=range(200)
l2=range(200)
k=range(10)
rg=range(200)
aa3 = 0
bb2 = 0.0
aa1 = 1
#输入坐标文本文件
inputFile = sys.argv[1]
#输出坐标文本文件
outputFile = sys.argv[2]
#inputt the number of the points
n = int(sys.argv[4])
#inputt the coordiate 54 or 80
d = int(sys.argv[3])
#ensure the zhengsuanfansuan or huandan
k0 = int(sys.argv[5])
#when fansuan ensure the l0(起始中央子午线经度)
try:
if len(sys.argv) > 9:
l0 = int(sys.argv[8])
else:
l0=0
except Exception ErrorDesc:
gp.AddError(str(ErrorDesc))
# 输入结束中央子午线经度
ll1 = int(sys.argv[6])
# 选择3度带或者6度带
d1 = int(sys.argv[7])
def zs1():
print
def fs1():
print
def hd():
print
def k54():
k[0]=6399698.90178271
k[1]=6367558.49687
k[2]=32005.7801
k[3]=133.9213
k[4]=0.7032
k[5]=0.005051773902
k[6]=0.000029838676
k[7]=6.738525414683492e-3
k[8]=0.000000241496
def k80():
k[0]=6399596.65198801
k[1]=6367452.13279
k[2]=32009.8575
k[3]=133.9602
k[4]=0.6976
k[5]=0.005052505593
k[6]=0.000029847335
k[7]=6.739501819472925e-3
k[8]=0.0000002416
def jdzh1(jd):
i=float(jd)
i = int(i)
j=float(jd)*100-int(i)*100
j = int(j)
##gp.AddError(i)
##gp.AddError(j)
k1=float(jd)*10000-float(i)*10000-float(j)*100
##gp.AddError(k1)
if k1>=60:
j=j+1
k1=0
jdd=float(i)*PI/180+float(j)*PI/180/60+float(k1)*PI/180/3600
##gp.AddError(jdd)
return jdd
def jdzh2(jd):
i=float(jd)*180/PI
i = int(i)
j=(float(jd)*180/PI-int(i))*60
j=int(j)
k=((float(jd)*180/PI-int(i))*60-int(j))*60
k = float(k)
jdd=float(i)+float(j)/100+float(k)/10000
return jdd
i = 0
if k0==1:
f=open(inputFile)
for a in f.readlines():
fu = a.split(‘‘)
b1[i]=fu[0]
l1[i]=fu[1]
i +=1
else:
f=open(inputFile)
for a in f.readlines():
fu = a.split(‘‘)
yy1[i]=float(fu[0])
x1[i]=float(fu[1])
i += 1
def zs():
o=range(20)
##gp.AddError(b2[i])
o[1]=math.tan(b2[i])
##gp.AddError(o[1])
o[2]=math.cos(b2[i])
##gp.AddError(o[2])
o[3]=k[7]*o[2]*o[2]
##gp.AddError(o[3])
o[4]=o[1]*o[1]
##gp.AddError(o[4])
o[5]=1+o[3]
##gp.AddError(o[5])
o[6]=k[0]/math.sqrt(o[5])
##gp.AddError(o[6])
o[7]=(l2[i]-ll2)*o[2]
o[8]=o[7]*o[7]
o[9]=o[1]*o[2]
o[10]=o[9]*o[9]
o[11]=(k[2]+o[10]*(k[3]+o[10]*k[4]))
###gp.AddError(o[11])
评论
共有 条评论