Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我目前正在尝试将一个空间文件剪辑到另一个空间文件,但是我得到的空间文件不是正确的形状。我知道使用光栅你必须使用蒙版,2个形状文件是否有类似的命令?
c1 <- crop(spatial1, spatial2)
使用 SpatialPolgyonDataFrame 对象
library(raster) p <- shapefile(system.file("external/lux.shp", package="raster")) b <- as(extent(6, 6.4, 49.75, 50), 'SpatialPolygons') crs(b) <- crs(r)
你可以做
pc <- crop(p, b)
你需要有包rgdal并rgeos安装。
rgdal
rgeos