開始使用免費開始

兩個多邊形圖層的疊置

回到土地使用與行政區這兩個資料集,這裡要把兩者透過疊置運算結合。請建立一個新的 GeoDataFrame,內容為土地使用多邊形與各行政區之間的交集,並且要保留兩個來源圖層的屬性資料。

GeoPandas 已經匯入。

本練習屬於課程

在 Python 中處理地理空間資料

檢視課程

練習說明

  • 列印兩個資料集(land_usedistricts)的前幾列。
  • land_usedistricts 的交集建立新的 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(____)
編輯並執行程式碼