小编Bux*_*ert的帖子

如何使用 .explore() 显示 geopandas 交互式地图

我制作了一个 geopandas 数据框,我想用它geopandas_dataframe.explore()来创建交互式地图。这是我的代码。首先,我创建 geopandas 数据框,检查 dtypes 并尝试使用gdf.explore(). 不幸的是,我的代码刚刚完成,没有错误,并且没有显示地图。

代码:

geometry = [Point(xy) for xy in zip(df[1], df[0])]
gdf = geopandas.GeoDataFrame(df, geometry=geometry)
print(gdf.head())
print(gdf.dtypes)
gdf.explore()
Run Code Online (Sandbox Code Playgroud)

输出:

           0         1                  geometry
0  51.858306  5.778404  POINT (5.77840 51.85831)
1  51.858322  5.778410  POINT (5.77841 51.85832)
2  51.858338  5.778416  POINT (5.77842 51.85834)
3  51.858354  5.778422  POINT (5.77842 51.85835)
4  51.858370  5.778429  POINT (5.77843 51.85837)
0            float64
1            float64
geometry    geometry
dtype: object

Process finished with exit code 0
Run Code Online (Sandbox Code Playgroud)

为什么我拿不到地图?我已经尝试过了gdf.show(),但那不存在。我需要做什么才能显示 geopandas …

python geopandas folium

4
推荐指数
1
解决办法
9970
查看次数

标签 统计

folium ×1

geopandas ×1

python ×1