小编jol*_*son的帖子

将 Python 绘图导出为 KML

如何使用 Matplotlib 创建经/纬度图,该图可以导出到 Google Earth,并且点可以正确显示在 GE 上。图片可以在这里看到: https: //i.stack.imgur.com/S2BX7.jpg 谷歌地球视图 似乎我导出的图形周围总是有一个轻微的边框,因此我在图中定义的点在 GE 中是关闭的

x = [0, 10, 10, 0, 0]
y = [10, 10, 0, 0, 10]
x1=[0,1,2,3,4,5,6,7,8,9,10]

fig = Figure(facecolor=None, frameon=False)
ax = fig.add_axes([0,0,1,1])
ax.axis('off')

ppl.plot(x, y, 'r',  axes=ax)
ppl.plot(x, y, '.b', axes=ax)
ppl.plot(x1, x1, 'g', axes=ax)

ppl.axis('off')
ppl.tight_layout(0,h_pad=0, w_pad=0)
border1 = ppl.axis(bbox_inches='tight')
ppl.show()

pngName = 'temp.png'
py.savefig(pngName, bbox_inches='tight', pad_inches=0, transparent=True)

bottomleft  = (border1[0],border1[2])
bottomright = (border1[1],border1[2])
topright    = (border1[1],border1[3])
topleft     = (border1[0],border1[3])

kml = simplekml.Kml()
ground = kml.newgroundoverlay(name='GroundOverlay')
ground.icon.href …
Run Code Online (Sandbox Code Playgroud)

python matplotlib kml

5
推荐指数
1
解决办法
1356
查看次数

标签 统计

kml ×1

matplotlib ×1

python ×1