【发布时间】:2015-02-13 05:30:14
【问题描述】:
我想在程序 R 中剪辑一个大的 shapefile (67MB),并从其中大约 5% 导出一个小得多的栅格。加载后,shapefile 具有 221388 个特征和 5 个字段 - 并扩展至 746 MB。
我的困难在于尝试将文件剪辑到可行的大小 - 程序在几分钟后崩溃。我已经尝试过裁剪(来自光栅)和 gIntersection(来自 rgeos)但没有成功。我有 8GB 的 RAM - 显然存在内存问题。
我猜可能有解决办法。我知道那里有一些大内存包 - 但它们中的任何一个都可以帮助我的这种情况吗?我当前的代码如下:
# dataset can be found at
# http://data.fao.org/map?entryId=271096b2-8a12-4050-9ff2-27c0fec16c8f
# location of files
ogrListLayers("C:/Users/Me/Documents/PNG Glob")
# import shapefile
ogrDrivers()[10,]
# shapefiles
Glob<-readOGR("C:/Users/Me/Documents/PNG Glob", layer="png_gc_adg_1")
# assign projection
Glob@proj4string<- CRS("+proj=longlat")
#object size
object.size(Glob)
# clipping
crop(Glob, extent(c(144,146,-7,-5)))
【问题讨论】:
-
this question 的答案可能会对您有所帮助。但我不确定在 Windows 上的可行性。
-
谢谢帕斯卡 - 我现在正在调查这个。
标签: r gis ram raster shapefile