You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Request: Please reference geos_unnest() in the man page for geos_make_collection()—perhaps under the details.
Context: After creating a geometry collection using geos::geos_make_collection() I found myself casting to an sf object to use sf::st_collection_extract(). After digging through the package documentation I finally found geos_unnest().
nc<-sf::st_read(system.file("shape/nc.shp", package="sf"))
#> Reading layer `nc' from data source #> `/Library/Frameworks/R.framework/Versions/4.1-arm64/Resources/library/sf/shape/nc.shp' #> using driver `ESRI Shapefile'#> Simple feature collection with 100 features and 14 fields#> Geometry type: MULTIPOLYGON#> Dimension: XY#> Bounding box: xmin: -84.32385 ymin: 33.88199 xmax: -75.45698 ymax: 36.58965#> Geodetic CRS: NAD27geo<-sf::st_centroid(nc) |>sf::st_geometry()
#> Warning in st_centroid.sf(nc): st_centroid assumes attributes are constant over#> geometries of xtris<-geo|>geos::geos_make_collection() |>geos::geos_delaunay_triangles()
# this is what i was doing sf::st_collection_extract(sf::st_as_sf(tris))
#> Simple feature collection with 186 features and 0 fields#> Geometry type: POLYGON#> Dimension: XY#> Bounding box: xmin: -84.05986 ymin: 34.07671 xmax: -75.8095 ymax: 36.49111#> Geodetic CRS: NAD27#> First 10 features:#> geometry#> 1 POLYGON ((-84.05986 35.1311...#> 2 POLYGON ((-83.82962 35.3450...#> 3 POLYGON ((-83.82962 35.3450...#> 4 POLYGON ((-83.82962 35.3450...#> 5 POLYGON ((-82.70541 35.8532...#> 6 POLYGON ((-82.70541 35.8532...#> 7 POLYGON ((-82.70541 35.8532...#> 8 POLYGON ((-82.70541 35.8532...#> 9 POLYGON ((-82.70541 35.8532...#> 10 POLYGON ((-81.49823 36.4314...# this is what i would've preferred (and now do)geos::geos_unnest(tris) |>
head()
#> <geos_geometry[6] with CRS=NAD27>#> [1] <POLYGON ((-84.05986 35.13111, -83.74725 35.05384, -83.82962 35.34507, -84.05986 35.13111))>#> [2] <POLYGON ((-83.82962 35.34507, -83.74725 35.05384, -83.42226 35.14516, -83.82962 35.34507))>#> [3] <POLYGON ((-83.82962 35.34507, -83.42226 35.14516, -83.48992 35.48069, -83.82962 35.34507))>#> [4] <POLYGON ((-83.82962 35.34507, -83.48992 35.48069, -82.70541 35.85323, -83.82962 35.34507))>#> [5] <POLYGON ((-82.70541 35.85323, -83.48992 35.48069, -82.98086 35.55136, -82.70541 35.85323))>#> [6] <POLYGON ((-82.70541 35.85323, -82.98086 35.55136, -82.52831 35.60684, -82.70541 35.85323))>
Request: Please reference geos_unnest() in the man page for geos_make_collection()—perhaps under the details.
Context: After creating a geometry collection using geos::geos_make_collection() I found myself casting to an sf object to use sf::st_collection_extract(). After digging through the package documentation I finally found geos_unnest().
Created on 2022-06-17 by the reprex package (v2.0.1)
The text was updated successfully, but these errors were encountered: