I am trying to do a point in polygon analysis This is my polygon
my_poly
class : SpatVector
geometry : polygons
dimensions : 2791790, 35 (geometries, attributes)
extent : -180, 180, -90, 90 (xmin, xmax, ymin, ymax)
coord. ref. : lon/lat WGS 84 (EPSG:4326)
names : basin_id lat_id lon_id l1 l2 l3 l4 l5 l6 l7 (and 25 more)
type : <num> <num> <num> <int> <int> <int> <int> <int> <int> <int>
values : 3.12e+09 654 407 40 54 43 55 53 50 53
8.12e+09 630 895 41 40 47 47 50 52 46
3.12e+09 598 267 37 37 47 39 42 50 45
# this is my point
grid_pts
class : SpatVector
geometry : points
dimensions : 9177, 1 (geometries, attributes)
extent : -76.35417, -75.25417, 44.9625, 45.52917 (xmin, xmax, ymin, ymax)
coord. ref. : lon/lat WGS 84 (EPSG:4326)
names : cell
type : <num>
values : 1
2
3
pts_basin <- terra::extract(my_poly, grid_pts)
Error in x@ptr$relate_between(y@ptr, relation) : std::bad_alloc
The polygon covers the entire globe while my point shapefile covers a small area. I only need the basin_id for each point.