ST_LineFromMultiPoint function

The ST_LineFromMultiPoint function takes a multipoint geometry as input parameter and constructs a linestring.

Syntax

Read syntax diagramSkip visual syntax diagram ST_LineFromMultiPoint ( geometry )

Parameter

geometry
A multipoint geometry object for which the linestring is to be created.

Return type

Returns a linestring geometry object that connects all of the points.

Example

The following example illustrates a multipoint linestring:
create table mpoints (id integer, geo st_multipoint) 

insert into mpoints values (1, st_mpointfromtext('multipoint (1 2,  3 4, 5 6)', 1003))  

select substr(st_astext(st_linefrommultipoint(geo)),1,80) as line from mpoints                                                                            

LINE       
--------------------------------------------------------------------------------       
LINESTRING (1.0000000 2.0000000, 3.0000000 4.0000000, 5.0000000 6.0000000)