Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug][jupyter] Serialization error on GeoDataFrames with multiple geometry columns #2283

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
8 changes: 1 addition & 7 deletions bindings/kepler.gl-jupyter/keplergl/keplergl.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
from traitlets import Unicode, Dict, Int, validate, TraitError
import pandas as pd
import geopandas
import shapely.wkt
import json
from ._version import EXTENSION_SPEC_VERSION
import sys
Expand Down Expand Up @@ -34,14 +33,9 @@ def _gdf_to_dict(gdf):
if gdf.crs and not gdf.crs == 4326:
gdf = gdf.to_crs(4326)

# get name of the geometry column
# will cause error if data frame has no geometry column
name = gdf.geometry.name

# convert geodataframe to dataframe
df = pd.DataFrame(gdf)
# convert geometry to wkt
df[name] = df.geometry.apply(lambda x: shapely.wkt.dumps(x))
df = pd.DataFrame(gdf.to_wkt())

return _df_to_dict(df)

Expand Down
3 changes: 1 addition & 2 deletions bindings/kepler.gl-jupyter/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
geopandas==0.5.0
geopandas==0.9.0
ipywidgets==7.4.2
pandas==0.24.2
Shapely==1.6.4.post2
traitlets==4.3.2
traittypes==0.2.1