如何在R中更改栅格图层的分辨率 [英] How to change the resolution of a raster layer in R

查看:223
本文介绍了如何在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:

alt.utm
类:RasterLayer
尺寸:4572、2495、11407140(nrow,ncol,ncell)
分辨率:30,30(x,y)
范围:421661、496511、4402939、4540099(xmin,xmax,ymin,ymax)
协调.参考:+ proj = utm + zone = 13 + ellps = GRS80 + towgs84 = 0,0,0,0,0,0,0 + units = m + no_defs
数据源:内存中
名称:层
值:1485.127,4275.202(最小,最大)

alt.utm
class : RasterLayer
dimensions : 4572, 2495, 11407140 (nrow, ncol, ncell)
resolution : 30, 30 (x, y)
extent : 421661, 496511, 4402939, 4540099 (xmin, xmax, ymin, ymax)
coord. ref. : +proj=utm +zone=13 +ellps=GRS80 +towgs84=0,0,0,0,0,0,0 +units=m +no_defs
data source : in memory
names : layer
values : 1485.127, 4275.202 (min, max)

推荐答案

您可以使用分解.

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中更改栅格图层的分辨率的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆