1

intro

I explain my geoprocess:

  1. start of a very long linestring
  2. Segmented linestring, 20 meter segments with ST_Segmentize, save the order of segments, ex 0 is start segment and 200 end segment
  3. I need to select certain segments within the linestring; selecting by order, ex: select segments between 10 and 20
  4. with the selected segements I need to join them in 1 single linestring

problem

the union of the selected segments does not generate a valid segment according to the answer

Converting MultiLinestring to Linestring with PostGIS?

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:

enter image description here

posible solution???

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?

  • This is quite late a reply, but have you tried using st_collect() instead? – scabecks Feb 21 at 4:40
0

Perhaps extract the individual points using ST_DumpPoints, and then connect them into a single LineString using ST_MakeLine(ST_Collect(pts)).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.