文档

ST_LineSubstring

更新时间:

返回指定LineString的子串。

语法

geometry  ST_LineSubstring(geometry  aLinestring , float8  startfraction , float8  endfraction);
geography ST_LineSubstring(geography  aLinestring , float8  startfraction , float8  endfraction);

参数

参数名称

描述

aLinestring

目标LineString对象。

startfraction

起始的位置。

endfraction

结束的位置。

描述

  • 当startfraction和endfraction取值相同时,等同于ST_LineInterpolatePoint

  • 如果想作用于MultiLineString对象,需要先使用ST_LineMerge合并。

  • 该函数支持3D对象,并且不会删除Z坐标。

  • 该函数支持M坐标。

示例

SELECT ST_AsText(ST_LineSubstring('LINESTRING(0 0,10 10)'::geometry,0.3,0.6));
      st_astext
---------------------
 LINESTRING(3 3,6 6)
(1 row)

--geography
SELECT ST_AsText(ST_LineSubstring('LINESTRING(0 0,10 10)'::geography,0.3,0.6));
                                   st_astext                                    
--------------------------------------------------------------------------------
 LINESTRING(2.97227762767668 3.01417970957332,5.96094221033023 6.0199989936211)      
  • 本页导读 (1)
文档反馈