I have a LINESTRING
called sel_river_sf
object with 3 features and I would like to merge those features in one single geometry.
sel_river_sf$NAME
contains the same string for the three features.
I tried to use the aggregate function:
aggregate(x = sel_river_sf, by = list(sel_river_sf$NAME), do_union=T ,FUN = unique)
The output is a MULTILINESTRING
object with one feature, I would like to obtain a LINESTRING
object with 1 feature as the subgeometries cause me problems in the sebsequent operations.
Before I tried st_combine
and st_union
and they show the same behaviour, also in combination with st_cast
.
I think there is a really simple way to obtain the expected result but I can't figure it out.
Many thanks for the help!
Riccardo
At the link below you can find a reproducible example, I used my real data as I think some issue is related to the geometries involved.There is only code in the link but it was too long to be pasted here.