坐标参考系

在 R 中可视化地理空间数据

Charlotte Wickham

Assistant Professor at Oregon State University

proj4string()

proj4string(countries_spdf)
"+proj=longlat +datum=WGS84 +no_defs +ellps=WGS84 +towgs84=0,0,0"

                                                                    ↑  适用于全球数据集 ↑

proj4string(water)
"+proj=longlat +datum=NAD83 +no_defs +ellps=GRS80 +towgs84=0,0,0"

                                                                    ↑ 常用于美国数据集 ↑

在 R 中可视化地理空间数据

proj4string()

proj4string(nyc_tracts)
"+proj=longlat +datum=NAD83 +no_defs +ellps=GRS80 +towgs84=0,0,0"
proj4string(neighborhoods)
"+proj=lcc +lat_1=40.66666666666666 +lat_2=41.03333333333333 
+lat_0=40.16666666666666 +lon_0=-74 +x_0=300000 +y_0=0 +datum=NAD83 

+units=us-ft +no_defs +ellps=GRS80 +towgs84=0,0,0"

兰伯特等角圆锥投影

在 R 中可视化地理空间数据

设置 CRS

x <- SpatialPoints(data.frame(-123.2620, 44.5646))
x
class       : SpatialPoints 
features    : 1 
extent      : -123.262, -123.262, 44.5646, 44.5646  (xmin, xmax, ymin, ymax)
coord. ref. : NA
proj4string(x) <- "+proj=longlat +datum=WGS84 +no_defs +ellps=WGS84 +towgs84=0,0,0"
x
class       : SpatialPoints 
features    : 1 
extent      : -123.262, -123.262, 44.5646, 44.5646  (xmin, xmax, ymin, ymax)
coord. ref. : +proj=longlat +datum=WGS84 +no_defs +ellps=WGS84 +towgs84=0,0,0
在 R 中可视化地理空间数据

CRS 变换

rgdal::spTransform(x, CRSobj, ...)

spTransform(x, "+proj=lcc +lat_1=40.66666666666666         
                +lat_2=41.03333333333333 +lat_0=40.16666666666666  
                +lon_0=-74 +x_0=300000 +y_0=0 +datum=NAD83
                +units=us-ft +no_defs +ellps=GRS80 +towgs84=0,0,0")
在 R 中可视化地理空间数据

CRS 变换

rgdal::spTransform(x, CRSobj, ...)

spTransform(x, proj4string(neighborhoods))
class       : SpatialPoints 
features    : 1 
extent      : -11214982, -11214982, 5127323, 5127323  (xmin, xmax, ymin, ymax)
coord. ref. : +proj=lcc +lat_1=40.66666666666666    
              +lat_2=41.03333333333333 +lat_0=40.16666666666666 
              +lon_0=-74 +x_0=300000 +y_0=0 +datum=NAD83 
              +units=us-ft +no_defs +ellps=GRS80 +towgs84=0,0,0 
在 R 中可视化地理空间数据

让我们来练习!

在 R 中可视化地理空间数据

Preparing Video For Download...