合并多个栅格图块时栅格损坏

发布于 2025-01-10 13:31:59 字数 685 浏览 1 评论 0原文

我有大约 1000 个光栅图块。 我正在尝试将它们合并为单个栅格图块。

library(raster)
raster_tile_path <- list.files("file_path", full.names = TRUE,
                                        pattern = ".tif" ))

merge_tile  <- lapply(raster_tile_path, raster)
merge_tile  <- do.call(merge, c(merge_tile, tolerance = 1))

运行时,我收到此错误:

Error in rgdal::getRasterData(con, offset = offs, region.dim = reg, band = object@data@band) : Failure during raster IO

有人已经建议了错误来源: https://stackoverflow.com/a/67607770/9101903< /a> 可能是坏的或损坏的光栅图块。但似乎没有解决方案来识别或忽略这个特定的栅格图块。

有人知道如何解决这个问题吗?

I have a around 1000 raster tiles.
I am trying to merge them as a single raster tile.

library(raster)
raster_tile_path <- list.files("file_path", full.names = TRUE,
                                        pattern = ".tif" ))

merge_tile  <- lapply(raster_tile_path, raster)
merge_tile  <- do.call(merge, c(merge_tile, tolerance = 1))

Upon running, i get this error:

Error in rgdal::getRasterData(con, offset = offs, region.dim = reg, band = object@data@band) : Failure during raster IO

Someone already suggested the source of error: https://stackoverflow.com/a/67607770/9101903 could be a bad or corrupted raster tile. But it seems that there is no solution to identify or ignore this specific raster tile.

Anybody got an idea on how to solve this?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

嘿哥们儿 2025-01-17 13:31:59

如果有损坏的文件,您应该能够像这样找到它

for (i in 1:length(merge_tile)) {
    x = merge_tile[[i]] * 1
}

当发生错误时,tile i is损坏

您也可以尝试

library(terra)
v <- vrt(raster_tile_path)
writeRaster(v, "file.tif")

If there is a corrupted file, you should be able to find it like this

for (i in 1:length(merge_tile)) {
    x = merge_tile[[i]] * 1
}

When an error occurs, tile i is corrupted

You could also try

library(terra)
v <- vrt(raster_tile_path)
writeRaster(v, "file.tif")
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文