开始使用免费开始使用

Urban Residents 邻里区域的中心点

现在请找到 urban_poly_3857 的中心点,并将其绘制在该多边形之上。

本练习是课程的一部分

在 Python 中可视化地理空间数据

查看课程

练习说明

  • 使用 GeoSeries 的 centroid 属性,从 urban_poly_3857 创建 downtown_center
  • 打印 downtown_center 的数据类型。
  • urban_poly_3857 绘制为 ax,颜色使用 lightgreen
  • 绘制 downtown_center,并设置 ax = axcolor = black。x 轴刻度已为您旋转。我们已包含显示图形的代码。

交互式实操练习

通过完成这段示例代码来试试这个练习。

# Create downtown_center from urban_poly_3857
downtown_center = urban_poly_3857.____.____

# Print the type of downtown_center 
print(type(downtown_center))

# Plot the urban_poly_3857 as ax and add the center point
ax = ____.plot(color = 'lightgreen')
____.plot(ax = ____, color = 'black')
plt.xticks(rotation = 45)

# Show the plot
plt.show()
编辑并运行代码