我有三个数字向量描述:
如何从中创建栅格对象? 我试图用cbind来组合它们:
# I prefer pacman::p_load(raster) to load package
library('raster')
# Sample very small subset of data:
lat <- c(84.6564178466797, 84.6564178466797, 83.3252105712891, 82.2175979614258,
80.3753433227539, 78.830451965332, 83.3252105712891)
long <- c(-145.316390991211, -70.6275939941406, -135.606842041016, -113.573654174805,
-102.370330810547, -104.610992431641, -79.5902481079102)
value <- c(0.379887759685516, 0.297680675983429, 0.259096682071686, 0.195639669895172,
0.259653329849243, 0.278579145669937, 0.333345)
myMatrix <- cbind(lat,long,value)
#this raster seems to be *incorrect*, because it shows: values: -145.3164, 84.65642 (min, max)
raster(myMatrix)
#Following causes an error (x cell sizes are not regular):
rasterFromXYZ(myMatrix)
但创建的对象存储的值不正确。
我是否需要先创建一个矩阵,如this主题中所述?