本文整理匯總了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')