mta*_*tao 1 gis r pixel raster
我有一个光栅文件(在 QGIS 中从矢量文件创建)。
我想知道在 R 中是否可能:
1)改变像素的值?(我相信所有单元格都具有关联的值“1”,或者至少具有蓝色像素(检查下面的图像),并且我不知道白色像素的值,但我想将其设置为“2” ,例如,所以它将是二进制的)
2)“裁剪”光栅?
以下是输入栅格的特征:
> catC1raster
class       : RasterLayer 
dimensions  : 1384, 2359, 3264856  (nrow, ncol, ncell)
resolution  : 30, 30  (x, y)
extent      : 325352.8, 396122.8, 4613074, 4654594  (xmin, xmax, ymin, ymax)
coord. ref. : +proj=utm +zone=31 +datum=WGS84 +units=m +no_defs +ellps=WGS84 +towgs84=0,0,0 
names       : CAT_C1_30m 
这是情节:
要将 NA 值(绘图上的白色)更改为 2,您可以使用reclassify
library(raster)
x <- reclassify(catC1raster, cbind(NA, 2))
或者,与terra包一起使用classify
library(terra)
x <- classify(catC1raster, cbind(NA, 2))
更多信息请点击这里:
https://rspatial.org/terra/spatial/8-rastermanip.html
| 归档时间: | 
 | 
| 查看次数: | 5442 次 | 
| 最近记录: |