ST_MakeLine - Amazon Redshift
Services or capabilities described in Amazon Web Services documentation might vary by Region. To see the differences applicable to the China Regions, see Getting Started with Amazon Web Services in China (PDF).

ST_MakeLine

ST_MakeLine creates a linestring from the input geometries.

The dimension of the returned geometry is the same as that of the input geometries. Both input geometries must of the same dimension.

Syntax

ST_MakeLine(geom1, geom2)

Arguments

geom1

A value of data type GEOMETRY or an expression that evaluates to a GEOMETRY type. The subtype must be POINT, LINESTRING, or MULTIPOINT.

geom2

A value of data type GEOMETRY or an expression that evaluates to a GEOMETRY type. The subtype must be POINT, LINESTRING, or MULTIPOINT.

Return type

GEOMETRY of subtype LINESTRING.

If geom1 or geom2 is null, then null is returned.

If geom1 and geom2 is the empty point or contains empty points, then these empty points are ignored.

If geom1 and geom2 are empty, then the empty LINESTRING is returned.

The spatial reference system identifier (SRID) value of the returned geometry is the SRID value of the input geometries.

If geom1 and geom2 have different SRID values, then an error is returned.

If geom1 or geom2 is not a POINT, LINESTRING, or MULTIPOINT, then an error is returned.

If geom1 and geom2 have different dimensions, then an error is returned.

Examples

The following SQL constructs a linestring from two input linestrings.

SELECT ST_MakeLine(ST_GeomFromText('LINESTRING(77.29 29.07,77.42 29.26,77.27 29.31,77.29 29.07)'), ST_GeomFromText('LINESTRING(88.29 39.07,88.42 39.26,88.27 39.31,88.29 39.07)'));
st_makeline ----------- 010200000008000000C3F5285C8F52534052B81E85EB113D407B14AE47E15A5340C3F5285C8F423D40E17A14AE475153408FC2F5285C4F3D40C3F5285C8F52534052B81E85EB113D40C3F5285C8F125640295C8FC2F58843407B14AE47E11A5640E17A14AE47A14340E17A14AE4711564048E17A14AEA74340C3F5285C8F125640295C8FC2F5884340