st_intersection produce Geometry type: GEOMETRY instead of Geometry type: POLYGON
Dear list members,
I am trying to "crop" a polygon (grid) with a polygon, but the result is an
sf object Geometry type: GEOMETRY, instead of an sf object Geometry type:
POLYGON.
How can I obtain an sf POLYGON?
nc = st_read(system.file("shape/nc.shp", package="sf"))
nc <- st_transform(nc, 3857)
g_50000 <- st_make_grid(nc, cellsize = 50000) |> st_as_sf()
g_50000 <- g_50000[nc, ]
g_50000_d <- st_union(g_50000)
g_25000 = st_make_grid(g_50000_d, cellsize = 25000) |> st_as_sf()
g_25000 # Geometry type: POLYGON
g_25000_c <- st_intersection(g_25000, g_50000_d)
g_25000_c # Geometry type: GEOMETRY
*Manuel Sp?nola, Ph.D.* Instituto Internacional en Conservaci?n y Manejo de Vida Silvestre Universidad Nacional Apartado 1350-3000 Heredia COSTA RICA mspinola at una.cr <mspinola at una.ac.cr> mspinola10 at gmail.com Tel?fono: (506) 8706 - 4662 Institutional website: ICOMVIS <http://www.icomvis.una.ac.cr/index.php/manuel> Blog sobre Ciencia de Datos: https://mspinola-ciencia-de-datos.netlify.app [[alternative HTML version deleted]]