1

I have 2 linestrings: Linestring 1 (-3 3, 6 8, 15 9, 22 13, 28.5 15.7) --> red color Linestring 2 (0 4.66666666666667, 6 8, 10 8.44444444444444) --> blue color

Actually both two linestrings are coincident

enter image description here

How do I get a part of linestring 1(red) that are not coincident with linestring 2 (blue) in PostGIS (as a multilinestring) ?

  • Welcome to GSE. Please perform the due diligence of reviewing the documentation on spatial operators before posting questions for which a one line answer is appropriate. – Vince Dec 13 '14 at 19:32
3

I think ST_Difference is what you are looking for.

  • No, the result is wrong, because there are some points in linestring 2 (blue) that are not part of linestring 1 (red). I have tried using both st_difference and st_symdifference, but the results are wrong – doel Dec 14 '14 at 11:45
  • I mean that there are some points in linestring 2 (blue) that are no the vertexs of linestring 1 (red). – doel Dec 14 '14 at 11:54
  • Perhaps you could state what output you expect, as ST_Difference answers your question as stated. – John Powell Dec 15 '14 at 6:16
  • the output I expect is a multi linestring: fist part of red linestring, and the second part of red linestring -> multilinestring((-3 3,0.466667),(10 8.4444,15 9,22 13,28.5 15.7)) – doel Dec 15 '14 at 6:47

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.