本文整理汇总了Python中simplekml.Kml.addfile方法的典型用法代码示例。如果您正苦于以下问题:Python Kml.addfile方法的具体用法?Python Kml.addfile怎么用?Python Kml.addfile使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类simplekml.Kml
的用法示例。
在下文中一共展示了Kml.addfile方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: main
# 需要导入模块: from simplekml import Kml [as 别名]
# 或者: from simplekml.Kml import addfile [as 别名]
#.........这里部分代码省略.........
Ellipsoids[i].rotate_eulerXY(math.pi,math.pi/2.)
if axes:
AxL[i].rotate_eulerXY(math.pi,math.pi/2.)
AxM[i].rotate_eulerXY(math.pi,math.pi/2.)
AxS[i].rotate_eulerXY(math.pi,math.pi/2.)
# Write .dae files ###############################
name='./'+Ellipsoids[i].name+'.dae'
c=colours(data['colour'][i])
t=(1.0)*data['transparency'][i].item()
write_collada_file(Ellipsoids[i].TP,
Ellipsoids[i].NP,
Ellipsoids[i].indices,
name,
c[0],c[1],c[2],t)
if axes:
write_collada_file(AxL[i].TP,
AxL[i].NP,
AxL[i].indices,
'./'+AxL[i].name+'.dae',
colours('black')[0],
colours('black')[1],
colours('black')[2],
0.0,
double_sided=True)
write_collada_file(AxM[i].TP,
AxM[i].NP,
AxM[i].indices,
'./'+AxM[i].name+'.dae',
colours('grey')[0],
colours('grey')[1],
colours('grey')[2],
0.0,
double_sided=True)
write_collada_file(AxS[i].TP,
AxS[i].NP,
AxS[i].indices,
'./'+AxS[i].name+'.dae',
colours('white')[0],
colours('white')[1],
colours('white')[2],
0.0,
double_sided=True)
# Create a KML document #########################
kml = Kml()
kml.document.name = "Ellipsoids"
for i in range(len(data)):
mod = kml.newmodel(altitudemode=AltitudeMode.relativetoground,
location='<longitude>'+repr(data['lon'][i])+'</longitude>'+
'<latitude>'+repr(data['lat'][i])+'</latitude>'+
'<altitude>'+repr(data['alt'][i])+'</altitude>',
visibility=1,
name=data['description'][i]
)
mod.link.href=('files/'+Ellipsoids[i].name+'.dae')
kml.addfile('./'+Ellipsoids[i].name+'.dae')
if axes:
modaxL = kml.newmodel(altitudemode=AltitudeMode.relativetoground,
location='<longitude>'+repr(data['lon'][i])+'</longitude>'+
'<latitude>'+repr(data['lat'][i])+'</latitude>'+
'<altitude>'+repr(data['alt'][i])+'</altitude>',
visibility=1,
name=data['description'][i]+'_axesL'
)
modaxL.link.href=('files/'+AxL[i].name+'.dae')
kml.addfile('./'+AxL[i].name+'.dae')
modaxM = kml.newmodel(altitudemode=AltitudeMode.relativetoground,
location='<longitude>'+repr(data['lon'][i])+'</longitude>'+
'<latitude>'+repr(data['lat'][i])+'</latitude>'+
'<altitude>'+repr(data['alt'][i])+'</altitude>',
visibility=1,
name=data['description'][i]+'_axesM'
)
modaxM.link.href=('files/'+AxM[i].name+'.dae')
kml.addfile('./'+AxM[i].name+'.dae')
modaxS = kml.newmodel(altitudemode=AltitudeMode.relativetoground,
location='<longitude>'+repr(data['lon'][i])+'</longitude>'+
'<latitude>'+repr(data['lat'][i])+'</latitude>'+
'<altitude>'+repr(data['alt'][i])+'</altitude>',
visibility=1,
name=data['description'][i]+'_axesS'
)
modaxS.link.href=('files/'+AxS[i].name+'.dae')
kml.addfile('./'+AxS[i].name+'.dae')
kml.savekmz(output)
if (nokeepfiles):
# Remove all intermediate Collada Files
for i in range(len(data)):
os.remove('./'+Ellipsoids[i].name+'.dae')
if axes:
for i in range(len(data)):
#os.remove('./'+ElAx[i].name+'.dae')
os.remove('./'+AxL[i].name+'.dae')
os.remove('./'+AxM[i].name+'.dae')
os.remove('./'+AxS[i].name+'.dae')