I explain my geoprocess:
- start of a very long linestring
- Segmented linestring, 20 meter segments with ST_Segmentize, save the order of segments, ex 0 is start segment and 200 end segment
- I need to select certain segments within the linestring; selecting by order, ex: select segments between 10 and 20
- with the selected segements I need to join them in 1 single linestring
the union of the selected segments does not generate a valid segment according to the answer
I usually use st_union to join the segments, and it works correctly while these are valid; the problem is that I have linestring not valid; this generate multilinestring
this is the case:
I think the best solution could be a recursive st_union that links all the segments in a certain order
generating step by step, singing linestring to generate a valid and simple linestring, this approach would be correct?
or can there be any tool in postgis that realizes this?