opengeos / leafmap

A Python package for interactive mapping and geospatial analysis with minimal coding in a Jupyter environment
https://leafmap.org
MIT License
3.23k stars 389 forks source link

`leafmap.leafmap` fails to `add_gdf` if index is numeric and does not start with 0 #924

Closed patel-zeel closed 1 month ago

patel-zeel commented 1 month ago

Environment Information

Description

leafmap.leafmap fails to show the gdf if index does not start with 0? Sometimes, we filter gdf during preprocessing, and thus, the index does not start with 0. leafmap.foliumap works with any index.

show_what_fails = True

import geopandas as gpd
from shapely.geometry import Point
if show_what_fails:
    import leafmap.leafmap as leafmap
else:
    import leafmap.foliumap as leafmap

gdf = gpd.GeoDataFrame({"geometry": [Point(70.778174, 26.654166)]}, crs="EPSG:4326")
gdf.index = [1]

m = leafmap.Map()
m.add_basemap("HYBRID")
m.add_gdf(gdf)
m