投影法と座標参照系

Pythonで可視化する地理空間データ

Mary van Valkenburg

Data Science Program Manager, Nashville Software School

投影法

球面地球を平面に展開した地図

Pythonで可視化する地理空間データ

地図投影法の多様なアプローチ

地図投影法に関する xkcd コミック

Pythonで可視化する地理空間データ

座標参照系

EPSG:4326

  • Google Earth で使用
  • 単位: 十進法度数

EPSG:3857

  • Google マップ、Bing マップ、OpenStreetMap で使用
  • 単位: メートル
Pythonで可視化する地理空間データ
School Name              Latitude     Longitude
A. Z. Kelley Elementary    36.021       -86.658
Alex Green Elementary      36.252       -86.832
Amqui Elementary           36.273       -86.703
Andrew Jackson Elementary  36.231       -86.623
import geopandas as gpd
schools['geometry'] = gpd.points_from_xy(schools.Longitude, schools.Latitude)
schools.head(4)
School Name                Latitude  Longitude                geometry
A. Z. Kelley Elementary      36.021    -86.658  POINT (-86.658 36.021)
Alex Green Elementary        36.252    -86.832  POINT (-86.832 36.252)
Amqui Elementary             36.273    -86.703  POINT (-86.703 36.273)
Andrew Jackson Elementary    36.231    -86.623  POINT (-86.623 36.231)
Pythonで可視化する地理空間データ

DataFrame から GeoDataFrame を作成する

import geopandas as gpd

schools_geo = gpd.GeoDataFrame(schools, 
                               crs = 'epsg:4326', 
                               geometry = schools.geometry)
schools_geo.head(4)
School Name                Latitude  Longitude               geometry
A. Z. Kelley Elementary      36.021    -86.658  POINT (-86.658 36.021)
Alex Green Elementary        36.252    -86.832  POINT (-86.832 36.252)
Amqui Elementary             36.273    -86.703  POINT (-86.703 36.273)
Andrew Jackson Elementary    36.231    -86.623  POINT (-86.623 36.231)
Pythonで可視化する地理空間データ

CRS の変換

schools_geo.head(2)
School Name              Latitude  Longitude                geometry
A. Z. Kelley Elementary    36.021    -86.658  POINT (-86.658 36.021)
Alex Green Elementary      36.252    -86.832  POINT (-86.832 36.252)
schools_geo.geometry = schools_geo.geometry.to_crs(epsg = 3857)
schools_geo.head(2)
School Name              Latitude  Longitude                      geometry
A. Z. Kelley Elementary    36.021    -86.658  POINT (-9646818.8 4303623.8)
Alex Green Elementary      36.252    -86.832  POINT (-9666119.5 4335484.4)
Pythonで可視化する地理空間データ

さあ、練習しましょう!

Pythonで可視化する地理空間データ

Preparing Video For Download...