Geopandas save as KML不包括列

2024-09-30 22:27:34 发布

您现在位置:Python中文网/ 问答频道 /正文

我试着把地质公园拯救成KML。在

下面是我的代码。在

import fiona
fiona.supported_drivers['KML'] = 'rw'
gp.io.file.fiona.drvsupport.supported_drivers['KML'] = 'rw'
a = df_geom[['Geohash_8','Geohash_7','Final Action (Coverage)','geometry']].head(3)
a.to_file('test.kml',driver='KML')

当我在googleearth中打开时,多边形不显示“最终操作(覆盖率)”。在


Tags: 代码ioimportdfkmlfilegpsupported
1条回答
网友
1楼 · 发布于 2024-09-30 22:27:34

我找到了解决办法。在

with open('./test.json', 'w') as f:
    f.write(a.to_json())
# YOU NEED TO INSTALL ogrogr FROM https://trac.osgeo.org/osgeo4w/
import subprocess
subprocess.call("ogr2ogr -f KML ./test.kml ./test.json ",shell=True)

相关问题 更多 >