Skip to content

Commit

Permalink
Fix add_gdf bug
Browse files Browse the repository at this point in the history
  • Loading branch information
giswqs committed Jun 29, 2023
1 parent fe06f52 commit 7573ef0
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions leafmap/leafmap.py
Original file line number Diff line number Diff line change
Expand Up @@ -2475,8 +2475,11 @@ def add_gdf(
encoding (str, optional): The encoding of the GeoDataFrame. Defaults to "utf-8".
"""
for col in gdf.columns:
if gdf[col].dtype in ["datetime64[ns]", "datetime64[ns, UTC]"]:
gdf[col] = gdf[col].astype(str)
try:
if gdf[col].dtype in ["datetime64[ns]", "datetime64[ns, UTC]"]:
gdf[col] = gdf[col].astype(str)
except Exception as e:
print(e)

data = gdf_to_geojson(gdf, epsg="4326")

Expand Down

0 comments on commit 7573ef0

Please sign in to comment.