How to simplify a MULTISURFACE, CURVEPOLYGON, or COMPOUNDCURVE geometry?
Asked Answered
A

0

4

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)?

Areopagus answered 16/8, 2021 at 23:0 Comment(4)
This github issue thread might point you in the right direction: github.com/r-spatial/sf/issues/748Infanticide
Thanks - I've been through that whole thread already, and while it helps if you have one type of weird geometry, it's not working for me because I have too many nested together. I've tried pretty much all the suggestions offered there with no luck.Areopagus
I have run up against this same problem and may have gotten one step closer to solving it, but have reposted a new question with a reproducible example here: #74480473Stome
I have this same problem and can't figure out how to solve it either.Vinegary

© 2022 - 2025 — McMap. All rights reserved.