In a table of linestring three segments are connected.


could Postgis generate the centroid of second segment and merge first and third at center? Is it possible?



The centroid of a line is not always on the line. What you want is the center along the line, you should look at the ST_LineInterpolatePoint, with a 0.5 parameter you can get the center of the second, if it's what you want.

I'm guessing you want the global center. You should before merge the lines with ST_LineMerge. Then you can split the line with this center with ST_Split.

  • Great! Work Fine. That's what I expected. Thank's! May 16 '20 at 14:34

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.