when I use over()
, the following error showed:
Error in (function (classes, fdef, mtable) :
Function 'over' tag 'SpatialPointsDataFrame', 'SpatVector' could not find inheritance method
coordinates(ht.dat) <- c("x","y")
proj4string(ht.dat) <- proj4string(bioms.shp)
ht.dat$biome <- over(ht.dat, bioms.shp)$BIOME
ht.dat <- as.data.frame(ht.dat)
table(ht.dat$biome)
class(biome.shp) is SpatVector class(ht.dat) is SpatialPointsDataFrame
I guess that the class of biome.shp is wrong. If the type of biome.shp can be changed to SpatialPolygons, this problem can be solved, but I don't know how to achieve it.