Closed gergness closed 1 year ago
You can use sf::st_collection_extract()
to get a (MULTI)POLYGON object:
fasterize(st_collection_extract(x, "POLYGON"), raster(x))
and see #1, personally I think it's right to use sf to set up the inputs (other streaming and efficiency options that aren't provided by sf can be relevant here)
When I read in some shape files, my sf object has geometry type "geometrycollection" because it contains both polygons and multipolygons. If I try to use fasterize on an object like this, I get an error saying that my geometry must be a polygon or multipolygon. I suppose I could convert polygons to multipolygons, but was hoping fasterize could be less strict about checking geometry type.