資料集簡介

在 Python 中處理地理空間資料

Joris Van den Bossche

Open source software developer and teacher, GeoPandas maintainer

IPIS 的手工採礦據點資料

IPIS:International Peace Information Service

圖片:Connormah,取自 Wikimedia Commons,授權為 CC BY-SA 3.0

在 Python 中處理地理空間資料

IPIS 的手工採礦據點資料

IPIS:International Peace Information Service 圖片:G.A.O,公有領域,取自 Wikimedia Commons

在 Python 中處理地理空間資料

IPIS 的手工採礦據點資料

在 Python 中處理地理空間資料

地理空間檔案格式

讀取檔案:geopandas.read_file("path/to/file.geojson")

支援的格式:

  • ESRI Shapefile
    • 一個「檔案」包含多個檔案!(.shp.dbf.shx.prj、…)
  • GeoJSON
  • GeoPackage(.gpkg

以及 PostGIS 資料庫!

在 Python 中處理地理空間資料

寫出為地理空間檔案格式

使用 to_file() 方法將 GeoDataFrame 寫出到檔案:

# 寫出 Shapefile 檔
geodataframe.to_file("mydata.shp", driver='ESRI Shapefile')

# 寫出 GeoJSON 檔
geodataframe.to_file("mydata.geojson", driver='GeoJSON')

# 寫出 GeoPackage 檔
geodataframe.to_file("mydata.gpkg", driver='GPKG')
在 Python 中處理地理空間資料

一起來練習吧!

在 Python 中處理地理空間資料

Preparing Video For Download...