How can I convert the line string to multiline string in PostGIS? I have converted geometry points to line string by this: st_makeline(location.shape)
but by this command:
SELECT uuid_generate_v4() AS uuid,
j."deviceId",
st_astext(st_linemerge(st_union(j.shape))) AS multiLine
FROM j
group by date, j."deviceId" ;
I got this results:
It's result is again line string?
Answer
Have you tried ST_Multi? https://postgis.net/docs/ST_Multi.html
select st_astext(st_multi(st_geometryfromtext('LINESTRING (30 10, 10 30, 40 40)')))
MULTILINESTRING((30 10,10 30,40 40))
For you this would be
SELECT uuid_generate_v4() AS uuid,
j."deviceId",
st_astext(st_multi(st_linemerge(st_union(j.shape)))) AS multiLine
FROM j
group by date, j."deviceId" ;
No comments:
Post a Comment