multipoint = st_multipoint(matrix(c(1, 3, 5, 1, 3, 1), ncol = 2))
multipoint |> ggplot() + geom_sf() + theme_minimal() +
labs(title = "Multipoint")
multipoint_2 = st_cast(linestring, "MULTIPOINT")
multipoint_3 = st_cast(polyg, "MULTIPOINT")
all.equal(multipoint, multipoint_2)
New Objects
multilinestring_list = list(matrix(c(1, 4, 5, 3), ncol = 2),
matrix(c(4, 4, 4, 1), ncol = 2),
matrix(c(2, 4, 2, 2), ncol = 2))
multilinestring = st_multilinestring(multilinestring_list)
multilinestring_sf = st_sf(geom = st_sfc(multilinestring))
multilinestring_sf
## Simple feature collection with 1 feature and 0 fields
## Geometry type: MULTILINESTRING
## Dimension: XY
## Bounding box: xmin: 1 ymin: 1 xmax: 4 ymax: 5
## CRS: NA
## geom
## 1 MULTILINESTRING ((1 5, 4 3)...
multilinestring_sf |> ggplot() + geom_sf() + theme_minimal() +
labs(title = "Multilinestring")
linestring_sf2 = st_cast(multilinestring_sf, "LINESTRING")
linestring_sf2
## Simple feature collection with 3 features and 0 fields
## Geometry type: LINESTRING
## Dimension: XY
## Bounding box: xmin: 1 ymin: 1 xmax: 4 ymax: 5
## CRS: NA
## geom
## 1 LINESTRING (1 5, 4 3)
## 2 LINESTRING (4 4, 4 1)
## 3 LINESTRING (2 2, 4 2)