How to reshape a LINESTRING sfc into equal length segments
Hi everyone. This is my first mail to this mailing list so excuse me if I'm
doing something wrong. I was wondering if it's possible to reshape a
LINESTRING sfc of all connected segments into equal length segments.
The sf object is formed by two touching linestring geometries of length 1m.
I would like to refactor the sf object into segments whose length is
approximately equal to 0.4m (I choose this value just for this example).
Since the two segments are touching each other, I'd like that the result
will be a new sf object with 5 geometries: 1) a linestring from (0, 0) to
(0, 0.4); 2) a linestring from (0, 0.4) to (0, 0.8); 3) a linestring from
(0, 0.8) to (0, 1) and from (0, 1) to (0.2, 1); 4) a linestring from (0.2,
1) to (0.6, 1) and 5) a linestring from (0.6, 1) to (1, 1).
Even if I use st_segmentize, the split of each segment does not consider
the neighbouring segments.
I'm sure that in a real dataset this is much more difficult and complicated
than this example since
1) it could happend that for one boundary point there are more than one
touching segments and
2) the total length of the network will never be an exact multiple of the
segment distance which implies that there will be some residuals
so, maybe, I'm just asking something unreasonable. I think that any
reasonable refactoring of the sfc of linestrings is fine for my
Il giorno gio 4 lug 2019 alle ore 11:56 Edzer Pebesma <
[hidden email]> ha scritto: