【问题标题】:How to do kriging with polygon data? (Do not want block kriging)如何对多边形数据进行克里金法? (不想要块克里金法)
【发布时间】:2015-01-26 15:50:01
【问题描述】:

我正在尝试应用克里金法来插值空气污染浓度(目标变量) 当我如下运行 krige 函数时,R 返回错误。

RSPAVE 是目标变量; air 是包含 RSPAVE 的数据集; TPU就是shapefile

k.o <- krige(RSPAVE ~1, locations=air, newdata=TPU, model=m.RSPAVE.f)

Error in predict.gstat(g, newdata = newdata, block = block, nsim = nsim, :
  gstat: value not allowed for: block kriging for long-lat data undefined

这可能是因为我的网格数据是一个 shapefile。但是我不想阻止克里金法,如何将多边形转为点,并应用普通克里金法?

非常感谢!

【问题讨论】:

    标签: r polygon interpolation kriging r-grid


    【解决方案1】:

    假设 RSPAVE 是一个 SpatialPolygonsDataFrame`,并且您想根据地理质心进行克里格法,这应该可以:

    Rpoint <- SpatialPointsDataFrame(coordinates(RSPAVE), data = RSPAVE@data, proj4string = CRS(proj4string(RSPAVE)))
    

    将其转换为点图层。

    然后和之前一样:

    k.o <- krige(Rpoint ~1, locations=air, newdata=TPU, model=m.RSPAVE.f)
    

    【讨论】:

    • 其实RSPAVE就是目标变量; air 是包含 RSPAVE 的数据集; TPU 是 shapefile。
    【解决方案2】:

    你说你的 TPU 网格是一个 shapefile,但它是什么数据类?如果 TPU 不是SpatialGridDataFramekrige 可能不知道如何预测它,默认为block

    对于 TPU 网格,我建议使用 spsample 后跟 gridded() 之类的东西在多边形上覆盖一个网格,尺寸为 SomeDimension

    grid.TPU = spsample(TPU, type = "regular", cellsize = c(SomeDimension, SomeDimension))
    
    gridded(grid.TPU) = TRUE
    

    然后

    k.o <- krige(RSPAVE ~1, locations=air, newdata=grid.TPU, model=m.RSPAVE.f)
    

    【讨论】:

      猜你喜欢
      • 2014-10-11
      • 2013-11-24
      • 2020-11-15
      • 2020-09-01
      • 2015-06-08
      • 2018-08-09
      • 2018-11-02
      • 2013-09-05
      • 2015-12-03
      相关资源
      最近更新 更多