【问题标题】:Snapping raster grids in R在 R 中捕捉栅格网格
【发布时间】:2015-08-14 04:14:00
【问题描述】:

我正在尝试对齐 R 中的两个栅格网格。对齐后,我希望能够将它们加在一起。

我已尝试检查制作堆栈是否可行:

grid_snap <- stack(GLC2000_sdw, afriPop_sdw)

我收到以下错误:

compareRaster(x) 中的错误:不同程度

栅格网格具有以下属性:

show(habi_sdw)
# class       : RasterLayer 
# dimensions  : 9187, 9717, 89270079  (nrow, ncol, ncell)
# resolution  : 0.00892857, 0.00892857  (x, y)
# extent      : -28.83706, 57.92186, -36.02464, 46.00214  (xmin, xmax, ymin, ymax)
# coord. ref. : +proj=longlat +ellps=WGS84 +towgs84=0,0,0,0,0,0,0 +no_defs 
# data source : C:\Users\di39\AppData\Local\Temp\R_raster_di39\raster_tmp_2015-08-12_172902_12860_17067.grd 
# names       : layer 
# values      : 0, 333707.6  (min, max)

show(Pop_sdw)
# class       : RasterLayer 
# dimensions  : 10143, 8858, 89846694  (nrow, ncol, ncell)
# resolution  : 0.008333333, 0.008333333  (x, y)
# extent      : -17.53524, 56.28143, -46.97893, 37.54607  (xmin, xmax, ymin, ymax)
# coord. ref. : +proj=longlat +datum=WGS84 +no_defs +ellps=WGS84 +towgs84=0,0,0 
# data source : C:\Users\di39\AppData\Local\Temp\R_raster_di39\raster_tmp_2015-08-12_170421_12860_12760.grd 
# names       : pop2010ppp 
# values      : 0, 128925.9  (min, max)

raster 包中使用alignExtent() 似乎不是正确的方法。

由于分辨率略有不同,我需要重新采样吗?

(0.00892857 x 0.00892857)与(0.008333333 与 0.008333333)

【问题讨论】:

标签: r geospatial spatial raster


【解决方案1】:

首先使用resample(GLC2000_sdw, afriPop_sdw, method="ngb"),然后使用crop (GLC2000_sdw, afriPop_sdw),确保它们的范围相同。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2023-03-17
    • 2017-06-09
    • 2021-11-23
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多