This is line string of my geometry column that created by postgis and shown in qgis: enter image description here

This is multiline string like above: enter image description here

I am new on gis and How can i do break line and convert it into multiline? I have converted geometry to multiline by this code:

st_astext(st_multi(st_linemerge(st_union(j.shape)))) as multiLine

but there is just one line as a MULTILINESTRING.it is like MULTILINESTRING((xx yy , aa rr)).How can i do break for example by distance between two points and creation date time for breaking line? Is it possible?

  • how exactly do you want that line segmented? seeing your other question, are you looking for a MultLinestring consisting of single Linestrings between GPS points? if so, these points do have a date column with a timestamp of the points collection?
    – geozelot
    Sep 5, 2018 at 9:18
  • I think i made a mistake. look , i have geometry column with it's timestamp, now how could i create multilinestring by check distance and timestamp between points?Means for example if distance between 2 points more than 200 meters and timestamp more than 1 min ,created other line in multiline string...this is my pg code codepad.org/wyesDSCX @ThingumaBob Sep 5, 2018 at 9:33
  • this is main table pasteall.org/pic/d803392cbb031cc63d66a6d8217c10fb -> olocayions @ThingumaBob Sep 5, 2018 at 9:36
  • After reading your last two comments i believe you will have to solve this in python. You need to create a new column "trip_id" for example and assign each point an ID based on some IF ELSE conditions. "if time > X min since last point, give it a new ID" ect. There is no spatial tool that will break up the line as you require.
    – Marshall
    Sep 6, 2018 at 2:35
  • There is not other way to solve that without using other language? Is it possible do just with postgres. @Marshall Sep 6, 2018 at 3:54


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.