答案 0 :(得分:0)
这回答标题中的问题"如何计算每个单元格中shapefile的点数"
library(rgdal) # this package to read and manipulate shapefiles
library(raster) # this package for rasters
shp <- readOGR("my_shape_file.shp") # read in your points from the shape file
ras <- raster("my_raster_file") # read in your raster
shp <- spTransform(shp, projection(ras)) # make sure that the two spatial objects share the same coordinate system
cells <- cellFromXY(ras,shp) # find which cells the points are in
table(cells) # and make a table of number of occurences in each cell
答案 1 :(得分:0)
mem