座標參考系統

在 Python 中處理地理空間資料

Joris Van den Bossche

Open source software developer and teacher, GeoPandas maintainer

座標參考系統(CRS)

艾菲爾鐵塔的位置:

POINT (2.2945 48.8584)

座標參考系統(CRS) 會將座標對應到地球上的特定位置。

在 Python 中處理地理空間資料

地理座標

緯度與經度(度分秒)。

例如 48°51′N,2°17′E

用於 GPS、網頁地圖應用…

注意!
在 Python 中使用 (lon, lat),而非 (lat, long)

  • 經度:[-180, 180]
  • 緯度:[-90, 90]
在 Python 中處理地理空間資料

地圖是 2D

在 Python 中處理地理空間資料

投影座標

(x, y) 座標通常以公尺或英尺表示

在 Python 中處理地理空間資料

投影座標—範例

Albers 等積投影

在 Python 中處理地理空間資料

投影座標—範例

墨卡托投影(Mercator)

在 Python 中處理地理空間資料

投影座標—範例

投影大小 vs 實際大小(墨卡托投影)

在 Python 中處理地理空間資料

指定 CRS

proj4 字串

範例:+proj=longlat +datum=WGS84 +no_defs

字典表示法:

{'proj': 'longlat', 'datum': 'WGS84', 'no_defs': True}

EPSG 代碼

範例:

EPSG:4326 = WGS84 地理座標 CRS(經度、緯度)

在 Python 中處理地理空間資料

GeoPandas 中的 CRS

GeoDataFrame/GeoSeries 的 .crs 屬性:

import geopandas
gdf = geopandas.read_file("countries.shp")
print(gdf.crs)
{'init': 'epsg:4326'}
在 Python 中處理地理空間資料

重點整理

  • 「地理」(long, lat)對比「投影」(x, y)座標
  • GeoPandas 的座標參考系統(CRS):.crs 屬性
  • 最常用的地理 CRS:WGS84 或 EPSG:4326
在 Python 中處理地理空間資料

一起來練習吧!

在 Python 中處理地理空間資料

Preparing Video For Download...