I have a dataframe of points and a shapefile with about 2000 named polygon. I'm trying to determine which polygon each point is in, but I'm having a difficult time. I tried this solution from google:
But this isn't completing, even for just a sample of 1000 points (after running for over 1 hour). This method will be absolutely impossible for my full dataframe of over 5 million points.
Does anybody else have a good solution? I would appreciate some help.
I have a good experience with sf::st_join() for point-in-polygon operations. As long as your datasets fit in memory. Just be sure to check that the coordinate reference systems are aligned.