如何在R中更改栅格图层的分辨率

如何在R中更改栅格图层的分辨率

本文介绍了如何在R中更改栅格图层的分辨率的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用的R中有几个高分辨率栅格图层.对于我正在运行的某些分析,详细程度过高,因此我想通过降低分辨率来加快处理速度.

I have several high resolution raster layers in R that I am working with. The level of detail is excessive for some of the analyses I am running, so I would like to speed things up by reducing the resolution.

坐标系为UTM,因此单位为米.分辨率说是30,30(x,y).因此,这里的分辨率似乎是30m.

The coordinate system is UTM so the units are meters. The resolution says it is 30, 30 (x, y). So it seems that the resolution here is 30m.

有人可以建议我如何将分辨率更改为120m吗?我已经阅读了resample()和projectRaster()函数的帮助,但它们似乎需要具有所需分辨率的模板栅格,而我没有.

Could someone please advise me on how to change the resolution to 120m instead? I have read the help for the resample() and projectRaster() functions but they seem to require a template raster with the desired resolution, which I don't have.

这是我的一个栅格图层的示例:

Here is an example of one of my raster layers:

推荐答案

您可以使用汇总分解.

library(raster)

#get some sample data
data(meuse.grid)
gridded(meuse.grid) <- ~x+y
meuse.raster <- raster(meuse.grid)
res(meuse.raster)
#[1] 40 40

#aggregate from 40x40 resolution to 120x120 (factor = 3)
meuse.raster.aggregate <- aggregate(meuse.raster, fact=3)
res(meuse.raster.aggregate)
#[1] 120 120

#disaggregate from 40x40 resolution to 10x10 (factor = 4)
meuse.raster.disaggregate <- disaggregate(meuse.raster, fact=4)
res(meuse.raster.disaggregate)
#[1] 10 10

这篇关于如何在R中更改栅格图层的分辨率的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-29 02:18