I just downloaded spatial information from the National Wetlands Inventory (NWI). I'm trying to manipulate the geometries in R (st_transform, st_cast, st_crop, etc.), but I've never seen a geometry this complicated.
library(tidyverse)
library(sf)
wetlands <- st_read('./CA_geodatabase_wetlands.gdb', layer = 'CA_Wetlands')
wetlands[1,] %>% st_geometry %>% st_as_text
[1] "MULTISURFACE (CURVEPOLYGON (COMPOUNDCURVE (LINESTRING (-2193424 1485786, -2193424 1485786, -2193424 1485787, -2193424 1485787, -2193426 1485793, -2193425 1485795, -2193419 1485806, -2193418 1485806, -2193418 1485807, -2193405 1485820, -2193404 1485820, -2193404 1485821, -2193393 1485828, -2193393 1485828, -2193391 1485829, -2193388 1485831, -2193368 1485843), CIRCULARSTRING (-2193368 1485843, -2193367 1485843, -2193366 1485843), LINESTRING (-2193366 1485843, -2193363 1485843, -2193359 1485845, -2193359 1485845, -2193359 1485846, -2193345 1485848, -2193344 1485848, -2193341 1485849), CIRCULARSTRING (-2193341 1485849, -2193340 1485850, -2193339 1485850), LINESTRING (-2193339 1485850, -2193295 1485854, -2193294 1485855, -2193282 1485857, -2193275 1485860, -2193275 1485860, -2193273 1485861, -2193266 1485866, -2193245 1485884, -2193239 1485889, -2193237 1485892, -2193237 1485892, -2193234 1485896, -2193234 1485896, -2193221 1485910), CIRCULARSTRING (-2193221 1485910, -2193220 1485910, -2193220 1485910), ....."
I cut off the entire printout because of the length, but you get the picture: I have a serious of nested geometries that include MULTISURFACE, CURVEPOLYGON, COMPOUNDCURVE, and CIRCULARSTRING, none of which work with the standard sf
functions. I can't even plot it to see what it looks like. How can I simplify this down to a more workable geometry (i.e. MULTIPOLYGON or MULTILINESTRING)?