## Name

ST_LineMerge — 返回通过将 MultiLineString 缝合在一起形成的线。

## Synopsis

`geometry ST_LineMerge(`geometry amultilinestring`)`;

`geometry ST_LineMerge(`geometry amultilinestring, boolean directed`)`;

## 描述

 仅与 MultiLineString/LineString 一起使用。 其他几何类型返回空的 GeometryCollection

 此函数剥离 M 维度。

## 示例

```SELECT ST_AsText(ST_LineMerge(
'MULTILINESTRING((10 160, 60 120), (120 140, 60 120), (120 140, 180 120))'
));
--------------------------------------------
LINESTRING(10 160,60 120,120 140,180 120)
```

```SELECT ST_AsText(ST_LineMerge(
'MULTILINESTRING((10 160, 60 120), (120 140, 60 120), (120 140, 180 120), (100 180, 120 140))'
));
--------------------------------------------
MULTILINESTRING((10 160,60 120,120 140),(100 180,120 140),(120 140,180 120))
```

```SELECT ST_AsText(ST_LineMerge(
'MULTILINESTRING((-29 -27,-30 -29.7,-36 -31,-45 -33),(-45.2 -33.2,-46 -32))'
));
----------------
MULTILINESTRING((-45.2 -33.2,-46 -32),(-29 -27,-30 -29.7,-36 -31,-45 -33))
```

```SELECT ST_AsText(ST_LineMerge(
'MULTILINESTRING((60 30, 10 70), (120 50, 60 30), (120 50, 180 30))',
TRUE));
-------------------------------------------------------
MULTILINESTRING((120 50,60 30,10 70),(120 50,180 30))
```

```SELECT ST_AsText(ST_LineMerge(
'MULTILINESTRING((-29 -27 11,-30 -29.7 10,-36 -31 5,-45 -33 6), (-29 -27 12,-30 -29.7 5), (-45 -33 1,-46 -32 11))'
));
--------------------------------------------------------------------------------------------------
LINESTRING Z (-30 -29.7 5,-29 -27 11,-30 -29.7 10,-36 -31 5,-45 -33 1,-46 -32 11)
```