两个多边形图层的叠加
回到土地利用与行政区两个数据集,我们将通过叠加操作把它们组合起来。请创建一个新的 GeoDataFrame,包含每个行政区与土地利用多边形的相交部分,并确保同时保留两个源图层的属性数据。
已导入 GeoPandas。
本练习是课程的一部分
在 Python 中处理地理空间数据
练习说明
- 打印两个数据集(
land_use和districts)的前几行。 - 基于
land_use与districts的相交结果创建一个新的 GeoDataFrame,并将结果赋给变量combined。 - 打印结果 GeoDataFrame(
combined)的前几行。
交互式实操练习
通过完成这段示例代码来试试这个练习。
# Print the first five rows of both datasets
print(____)
print(____)
# Overlay both datasets based on the intersection
combined = geopandas.____(____, ____, how='____')
# Print the first five rows of the result
print(____)