能否将Plotly散点图导出为kml文件?我有一个使用matplotlib
的示例,但是否可能使用Plotly执行相同的输出?
Plotly图是散点图。它可以转换为kml输出吗?当尝试导出为kml时,我返回了一个错误。
import plotly.express as px
import geopandas as gpd
import simplekml
import matplotlib.pyplot as ppl
from pylab import rcParams
gdf = gpd.read_file(gpd.datasets.get_path("naturalearth_cities"))
gdf['LON'] = gdf['geometry'].x
gdf['LAT'] = gdf['geometry'].y
fig = px.scatter_mapbox(data_frame = gdf,
lat = 'LAT',
lon = 'LON',
zoom = 1,
mapbox_style = 'carto-positron',
)
fig.show()
fig.write_image('test.kml')
输出:
ValueError: Invalid format 'kml'.
Supported formats: ['png', 'jpg', 'jpeg', 'webp', 'svg', 'pdf', 'eps', 'json']