Hi there π, I'm Christoph, a geospatial engineer and data scientist. I'm interested in all things πΊοΈ Geospatial, π§βπ¬ Data Science, βοΈ Machine Learning and π Python.
If you want to support my work:
πΎ Streamlit Component for rendering kepler.gl maps
License: MIT License
Hi!
Using streamlit-keplergl, it works like the demo but when I add new data from a csv file, it does not show on the map.
here is part of the code:
with open(CONFIG, 'r') as stream:
config = yaml.safe_load(stream)
data = pd.read_csv( 'file.csv')
st.dataframe(data.head())
# Build map finally
map = KeplerGl(height=800, data={NAME: data}, config=config)
note: this works on other environments like google colab and Jupiter.
am I doing sth wrong?
Hi, I am trying to load a GeoJson dataset onto the map and I am able to do so successfully and view in a streamlit dashboard however when I specify a config in the KeplerGl() function call keplergl_static(my_map) nothing renders on the dashboard. I can run the same code in a Jupyter notebook and specify the config and the map renders as expected.
When toogleing the geocoder functionality (sidebar, interaction), the kepler-gl window becomes black. Checked in Jupter notebook and this does not happen. Only happens with the geocoder button, the others are fine.
Also couldn't find relevant issue upstream, muste be something streamlit component related.
Originally posted by @lennonzheng in #4 (comment)
keplergl_static(map)
File "/opt/anaconda3/lib/python3.8/site-packages/streamlit_keplergl/__init__.py", line 29, in keplergl_static
html = fig._repr_html_()
File "/opt/anaconda3/lib/python3.8/site-packages/keplergl/keplergl.py", line 170, in _repr_html_
keplergl_data = json.dumps({"config": config_to_add, "data": data_to_add, "options": {"readOnly": read_only, "centerMap": center_map}})
File "/opt/anaconda3/lib/python3.8/json/__init__.py", line 231, in dumps
return _default_encoder.encode(obj)
File "/opt/anaconda3/lib/python3.8/json/encoder.py", line 199, in encode
chunks = self.iterencode(o, _one_shot=True)
File "/opt/anaconda3/lib/python3.8/json/encoder.py", line 257, in iterencode
return _iterencode(o, 0)
File "/opt/anaconda3/lib/python3.8/json/encoder.py", line 179, in default
raise TypeError(f'Object of type {o.__class__.__name__} '
TypeError: Object of type Timestamp is not JSON serializable```
Here are all of the types in my GeoDataFrame:
```TimeUTC datetime64[ns]
AeroscopeID string
DroneType string
Callsign string
FlightID string
Latitude float64
Longitude float64
Altitude float64
HomeLongitude float64
HomeLatitude float64
PilotLongitude float64
PilotLatitude float64
geometry geometry
dtype: object```
There is no "Timestamp" column.
I tried duplicating TimeUTC and converting it to a string with no luck.
Hi there,
Just wanted to give you a heads up in case other people face the same issue. For some reason when I created a new virtual env in Anaconda and streamlit-keplergl was upgraded to the new version 0.2.0 my streamlit app stopped plotting the data altogether, but when reverted to 0.1.0 it started working as per usual. I have no idea why though as I am still pretty new to python/streamlit/kepler.
Cheeers,
Cole
Passing the height
parameter achieved the desired result, but width
does not.
Also raised on https://discuss.streamlit.io/t/adapt-container-streamlit-keplergl/14821
I created a demo app to load a geojson and can display fine, but the map always loads over San Fransisco. I think it may be because the dataframe is not passed using the data
attribute? Unsure.
import streamlit as st
from streamlit_keplergl import keplergl_static
from keplergl import KeplerGl
import geopandas as gpd
infile = 'data/my.json'
df = gpd.read_file(infile)
map_1 = KeplerGl(height=800)
map_1.add_data(df, 'data_1')
keplergl_static(map_1)
# Show data table
st.dataframe(df.drop(columns=['geometry']))
I can't deploy keplergl map in Streamlit when I use geopandas and movingpandas in my dataframe. When I only use original dataframe, with latitude and longitude data, works well, but when I use these libraries to analysis stop points and trajectories, I get an error.
Obs.: I used Jupyter to test and visualize the map, but the app is .py file made in VS Code.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. πππ
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google β€οΈ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.