疊加空間資料集

在 Python 中處理地理空間資料

Joris Van den Bossche

Open source software developer and teacher, GeoPandas maintainer

與多邊形求交

countries.intersection(circle)
在 Python 中處理地理空間資料

與多邊形求交

countries.intersection(circle) 的限制:

  • 僅能將 GeoSeries 與單一多邊形相交
  • 不保留屬性資訊
在 Python 中處理地理空間資料

疊加兩個資料集

countries.plot()

geologic_regions.plot()
在 Python 中處理地理空間資料

疊加兩個資料集

geopandas.overlay(countries, geologic_regions, 
                  how='intersection')
在 Python 中處理地理空間資料

疊加 vs 交集

交集方法(單一多邊形)

countries.intersection(geologic_region_A)
0                            ()
1    POLYGON ((-1.661 48.803...
2    POLYGON ((1.201 51.145,...
dtype: object

疊加方法

geopandas.overlay(countries, geologic_regions,
                  how='intersection')
     name geologic_region              geometry
1  France               C  POLYGON ((2.5 51....
2      UK               C  POLYGON ((0.7 52 ...
3  France               B  POLYGON ((-1.7 46...
..    ...             ...                   ...
在 Python 中處理地理空間資料

一起來練習吧!

在 Python 中處理地理空間資料

Preparing Video For Download...