Name

ST_LineMerge — 返回由缝合在一起的多重线串形成的线条。

Synopsis

geometry ST_LineMerge(geometry amultilinestring);

描述

返回通过将多重线串的组成线条连接在一起而形成的线串或多重线串。线在双向交点处的端点处连接。线不会跨三向或更大角度的交点连接。

[Note]

仅与多重线串/线串一起使用。如果将面或GeometryCollection传递给此函数,它将返回空的GeometryCollection

由GEOS模块执行。

可用性:1.1.0

[Warning]

此函数将剥离M维度。

示例

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

如果由于非接触线而无法合并,则返回原始的多行字符串。

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

显示Z维度处理的示例。

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))'
        ));
st_astext
--------------------------------------------------------------------------------------------------
LINESTRING Z (-30 -29.7 5,-29 -27 11,-30 -29.7 10,-36 -31 5,-45 -33 1,-46 -32 11)

另请参阅

ST_Segmentize, ST_LineSubstring