Answers:
我想到两个选择。如果您想要一个特定的,LINESTRING
则可以使用ST_NumGeometries()和ST_GeometryN()。另外,如果要所有子几何,请ST_Dump()。
在实际阅读了问题之后,您需要从postgis-users列表中执行与该帖子类似的操作:
SELECT ST_AsText( ST_MakeLine(sp,ep) )
FROM
-- extract the endpoints for every 2-point line segment for each linestring
(SELECT
ST_PointN(geom, generate_series(1, ST_NPoints(geom)-1)) as sp,
ST_PointN(geom, generate_series(2, ST_NPoints(geom) )) as ep
FROM
-- extract the individual linestrings
(SELECT (ST_Dump(ST_Boundary(geom))).geom
FROM mypolygontable
-- eliminate 0 length linestring
where st_x(st_startpoint(geom))<> st_x(st_endpoint(geom))
) AS linestrings
) AS segments;
LINESTRING
“从A SMULTILINESTRING
。但是我想更深入一点,我想要单独的线段,这些线段在合并时形成的线段,在合并LINESTRING
时又形成原始的线段MULTILINESTRING
。那有意义吗?