我如何使用开普勒.gl与Django后端



是否有一个开普勒库我可以安装在我的django项目中使用开普勒。Gl在我的前端,就像在leaflet-django。如果没有,我怎么用开普勒。Gl映射作为django后端前端?

您可以访问"kepler.gl/demo"然后单击左侧栏中的导出到html。之后,你可以在django中使用这个html作为你的端点(视图模板)。

数据可以通过views.py中的httpResponse从数据库传递到脚本中的视图。如果你喜欢,你可以把脚本代码放在单独的Javascript文件中,并将它们链接到你的端点。

你可以在python中使用keplergl模块。我想这能满足你的要求。你可以使用"from keplergl import keplergl "要导入它并使用下面的代码片段:

from keplergl import KeplerGl 
map_1 = KeplerGl(height=600, config=custom_config)
// Add the data to the map
map_1.add_data(data=data, name="MAP NAME")
map_html =  map_1._repr_html_()
@router.get("/{path}")
async def index():
return HTMLResponse(content=map_html, status_code=200)

最新更新