prio-data/priogrid

vector_to_pg using raster::rasterize() and sf objects

Closed this issue · 1 comments

See 12de835.

I have used raster::rasterize() with sf objects before, but with the latest update (3.3-7), it seems not to work? One solution, I think, is to transform to sp before rasterizing: as(sfdf, "Spatial"). Another would be to look for other solutions. fasterize might be one? https://r-spatial.github.io/stars/ is probably the long term solution, but unsure about how well it works today.

It looks like raster::rasterize() is working on sf objects again (package version 3.3-13). It's at least working on sf point data. I updated vector_to_pg() with rasterize because fasterize does not take point data, only polygons.