【发布时间】:2013-03-30 16:10:28
【问题描述】:
我使用 R 包栅格从 www.GADM.org 导入了世界地图数据集。我想将它剪辑到我创建的多边形以减小地图的大小。我可以检索数据并且可以创建多边形没问题,但是当我使用“gIntersection”命令时,我收到一条模糊的错误消息。
关于如何剪辑我的世界地图数据集有什么建议吗?
library(raster)
library(rgeos)
## Download Map of the World ##
WorldMap <- getData('countries')
## Create the clipping polygon
clip.extent <- as(extent(-20, 40, 30, 72), "SpatialPolygons")
proj4string(clip.extent) <- CRS(proj4string(WorldMap))
## Clip the map
EuropeMap <- gIntersection(WorldMap, clip.extent, byid = TRUE)
错误信息:
RGEOSBinTopoFunc(spgeom1, spgeom2, byid, id, "rgeos_intersection") 中的错误: 几何集合可能不包含其他几何集合 另外:警告信息: 在 RGEOSBinTopoFunc(spgeom1, spgeom2, byid, id, "rgeos_intersection") 中: spgeom1 和 spgeom2 有不同的 proj4 字符串
【问题讨论】: