【发布时间】:2015-10-13 13:57:42
【问题描述】:
我有一个来自同事的地图 shapefile,我还获得了一些观测数据,它们的坐标记录在 WGS84 中。我在 R 中阅读了 shapefile:
# read shapefile
> shpmap <- readOGR(dsn = "soil_type", layer = "soil_type_data")
OGR data source with driver: ESRI Shapefile
Source: "soil_type", layer: "soil_type_data"
with 18542 features
It has 8 fields
# show shapefile attributes
> shpmap
class : SpatialPolygonsDataFrame
features : 18542
extent : 44795.53, 1572888, 3187943, 4661428 (xmin, xmax, ymin, ymax)
coord. ref. : +proj=aea +lat_1=25 +lat_2=47 +lat_0=0 +lon_0=105 +x_0=0 +y_0=0 +ellps=krass +units=m +no_defs
阅读 shapefile 后,我发现它使用的是 krassovsky ellps。现在我想做两件事。首先,更改 shapefile 的投影以匹配我的观察结果 WGS84。其次,shapefile 包含几个土壤属性,我想将它们转换为 rasterstack 对象。
我是在 R 中处理 GIS 文件的新手,我真的很困惑。我将不胜感激任何建议!提前致谢!
【问题讨论】:
-
你需要
spTransform()和rasterize()。 -
谢谢!我已经按照您的建议解决了!
标签: r projection raster