Streamlit component that allows you to do bidirectional communication with Kepler
Project description
WENOKN Streamlit Kepler Component
Kepler.gl is a powerful open-source geospatial visualization tool developed by Uber. It enables users to effortlessly create custom, interactive maps from large-scale location data. With its intuitive interface and extensive customization options, Kepler.gl empowers users to explore and analyze geographic patterns, trends, and relationships. Whether for urban planning, logistics optimization, or data journalism, Kepler.gl provides a user-friendly solution for visualizing complex spatial datasets. Its versatility, ease of use, and ability to handle big data make it an essential tool for anyone needing to understand and communicate insights from geospatial information effectively.
The following three libraries - geemap, leafmap, and streamlit-kepler - currently offer support for integrating Kepler.gl into Streamlit, facilitating data presentation. However, they are limited to static Kepler maps. "Static" implies that once the map is rendered, Streamlit cannot manipulate it further or retrieve its current state. To modify data, the map must be re-rendered. This restriction significantly constrains Kepler's utility in Streamlit. Many applications demand dynamic capabilities, enabling Streamlit and Kepler to communicate bidirectionally - adding or removing data at any time and responding to user interactions on the map promptly and flexibly.
We've created a Streamlit component for Kepler, enabling seamless bidirectional communication between Streamlit and Kepler. Now, Streamlit can effortlessly retrieve the map's current state and dynamically adjust the application accordingly. Additionally, Streamlit gains the ability to add data to the map on-the-fly, independent of whether the map has been previously rendered. This breakthrough empowers users to interact fluidly with the map, enhancing the application's versatility and responsiveness.
Installation instructions
pip install streamlit-kepler-component
Usage instructions
In the present prototype, Kepler.gl accepts the following parameters:
- A list of GeoDataframes or Dataframes
- options
- config
- height
When there's an interaction with the map, such as a mouse movement, the Kepler streamlit component returns the current map configuration. In simpler terms, any action performed on the map will prompt the entire page to be re-rendered. To ensure smooth functioning and avoid potential bugs, it's essential to utilize session state management for your web page and execute any prolonged actions within a separate thread.
Example
import json
import streamlit as st
import geopandas as gpd
from keplergl import keplergl
if "datasets" not in st.session_state:
st.session_state.datasets = []
sf_zip_geo_gdf = gpd.read_file("sf_zip_geo.geojson")
sf_zip_geo_gdf.label = "SF Zip Geo"
sf_zip_geo_gdf.id = "sf-zip-geo"
st.session_state.datasets.append(sf_zip_geo_gdf)
h3_hex_id_df = pd.read_csv("keplergl/h3_data.csv")
h3_hex_id_df.label = "H3 Hexagons V2"
h3_hex_id_df.id = "h3-hex-id"
st.session_state.datasets.append(h3_hex_id_df)
map_config = keplergl(st.session_state.datasets, height=400)
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file streamlit-kepler-component-0.0.11.tar.gz.
File metadata
- Download URL: streamlit-kepler-component-0.0.11.tar.gz
- Upload date:
- Size: 8.2 MB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.0.0 CPython/3.9.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4620ddcb3a52751c12bc4452dd8ca6a5494665f1ddb171729605d5fe00b677f7
|
|
| MD5 |
5a9ca05fb1edf47df08f67aaefa2e5d9
|
|
| BLAKE2b-256 |
8e5a8b50c580158a8e0c9cb05a12a4da807e8ed00b8b4e18de84745618ec3ccc
|
File details
Details for the file streamlit_kepler_component-0.0.11-py3-none-any.whl.
File metadata
- Download URL: streamlit_kepler_component-0.0.11-py3-none-any.whl
- Upload date:
- Size: 24.8 MB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.0.0 CPython/3.9.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
75a98d350617d4673c431e462d37cae48014fe3ae2fab30b96ddec52b4ea8872
|
|
| MD5 |
45e1118645fb1d7c00ad93c99036fd20
|
|
| BLAKE2b-256 |
5ae7578f579648c8c46660e8c8008c94075224d7fa6a22f20132d4db1bf2d199
|