使用postgis创建通过多边形路径的中线

问题描述 投票:2回答:1

我正在尝试通过多边形路径创建一条中间线,但遇到了问题,现在我完全不知道该怎么做。任何人都可以帮助实现这一目标吗?

enter image description here

postgresql gis postgis polygon
1个回答
0
投票

ST_ApproximateMedialAxis可能就是您想要的。

此PostGIS功能可以使用扩展名ST_ApproximateMedialAxis安装:

postgis_sfcgal

数据样本:

postgis_sfcgal

CREATE EXTENSION postgis_sfcgal

查询:

CREATE TABLE t (geom GEOMETRY);
INSERT INTO t VALUES ('POLYGON((-4.689807593822478 54.20411976258862,-4.68751162290573 54.20415427666532,-4.686465561389922 54.20414172609529,-4.685768187046051 54.20414800138079,-4.685280025005341 54.20414486373812,-4.685070812702178 54.204126037877415,-4.685092270374298 54.2040538719985,-4.685854017734527 54.204078973188075,-4.687039554119109 54.20407583554021,-4.688123166561126 54.204082110835685,-4.689078032970428 54.2040601472973,-4.689936339855194 54.20403818374726,-4.689807593822478 54.20411976258862))');

enter image description here

取决于您的用例,另一个选项是SELECT ST_ASText(ST_ApproximateMedialAxis(geom)) FROM t; -------------------------------------------------------- MULTILINESTRING((-4.68993633985519 54.2040381837473,-4.68979598869017 54.2040808603332),(-4.68812343743121 54.2041135944836,-4.68907889005644 54.2040954248621),(-4.68812343743121 54.2041135944836,-4.68751156547988 54.2041164214432),(-4.68646560965613 54.2041095395079,-4.6858535007301 54.2041131034922),(-4.68646560965613 54.2041095395079,-4.68703949691079 54.2041122226661),(-4.6858535007301 54.2041131034922,-4.68576814087419 54.2041120816007),(-4.68907889005644 54.2040954248621,-4.68979598869017 54.2040808603332),(-4.68576814087419 54.2041120816007,-4.68528206303828 54.2041025125126),(-4.68703949691079 54.2041122226661,-4.68751156547988 54.2041164214432),(-4.68512015518242 54.2040925683677,-4.68528206303828 54.2041025125126)) (1 Zeile)

enter image description here

ST_StraightSkeleton

© www.soinside.com 2019 - 2024. All rights reserved.