在 R 中从 Behrmann CRS 映射转换为 +proj=longlat WGS84
Posted
技术标签:
【中文标题】在 R 中从 Behrmann CRS 映射转换为 +proj=longlat WGS84【英文标题】:Converting from Behrmann CRS map to +proj=longlat WGS84 in R 【发布时间】:2019-01-19 03:32:04 【问题描述】:我有一个 200 公里 x 200 公里的网格单元形状文件,覆盖贝尔曼等面积圆柱投影中的世界陆地区域。我的目标是将 shapefile 转换为 +proj=longlat WGS84 格式,以便我可以将其与常用投影中的地图相匹配,例如 maptools 中的 wrld_simpl。但是,我没有成功,希望能得到一些帮助。
rm(list = ls())
library(RCurl)
library(raster)
library(maptools)
library(rgdal)
data("wrld_simpl")
tmp <- tempfile() download.file("https://github.com/darunabas/extras/blob/master/temp_shapefile.zip?raw=true", destfile = tmp)
unzip(tmp, exdir = ".")
s <- rgdal::readOGR("temp_shapefile")
proj4string(s) = CRS("+proj=cea +lon_0=0 +lat_ts=30 +x_0=0 +y_0=0 +datum=WGS84 +ellps=WGS84 +units=m +no_defs")
p <- spTransform(s, CRS("+proj=longlat +datum=WGS84"))
我收到以下错误: 检测到非有限变换: [,1] [,2] [,3] [,4] .spTransform_Polygon(input[[i]], to_args = to_args, from_args = from_args, 中的错误: 多边形失败 1106 多边形 1 分 另外:警告信息: 在 .spTransform_Polygon(input[[i]], to_args = to_args, from_args = from_args, : 2 个投影点不是有限的
【问题讨论】:
【参考方案1】:我在地理世界上不是很有经验,但这可能会有所帮助:
library( sf )
sf <- read_sf( "./temp_shapefile.shp")
st_crs( sf ) <- "+proj=cea +lon_0=0 +lat_ts=30 +x_0=0 +y_0=0 +datum=WGS84 +ellps=WGS84 +units=m +no_defs"
sf2 <- st_transform( sf, crs = "+proj=longlat +datum=WGS84" )
【讨论】:
感谢@Wimpel 的建议。虽然它没有返回任何错误,但生成的图看起来很奇怪,在赤道下方有一条长线,投影地图中缺少许多网格单元。以上是关于在 R 中从 Behrmann CRS 映射转换为 +proj=longlat WGS84的主要内容,如果未能解决你的问题,请参考以下文章
应用于 R 中的列表对象时,projectRaster 无法更改 crs