获取正确方向的栅格数据

问题描述

我在获取正确方向的栅格数据时遇到问题。导入到 R 中的原始栅格数据看起来像这样

Original data

我尝试在光栅中使用转置功能,但没有用。转置后的数据看起来像这样

Transposed

我使用了下面的代码。任何帮助或建议将不胜感激。另外,有没有办法将合理的解决方案应用于整个堆栈(所有栅格的范围相同)?谢谢。

f_PM <- list.files(path=".",pattern='tif$',full.names=TRUE)
s_PM <- stack(f_PM) ## create a stack of the rasters
plot(s_PM[[1]]) ##check the orientation
PM <- s_PM[[1]] ## pick one raster and try to change the orientation
PM2 <- t(PM)
plot(PM2)

解决方法

你需要翻转然后转置:

> plot(m)
> r = t(flip(m))
> plot(r)

enter image description here

请注意,在 https://gis.stackexchange.com 处会询问此类空间问题。 (这里的噪音太大,无法处理大多数空间内容)。