ST_近似MedialAxis最终逼近骨架线

时间:2018-12-21 05:53:04

标签: postgresql postgis computational-geometry medial-axis

我想近似一个封闭的多边形,但是PostGIS给我的不是干净的线串,而是带有3个线串的多线串。都是因为从直的骨骼上留下了那条细小的尾巴。 the polygon the tail 有什么适当或好的方法来解决这个问题?

1 个答案:

答案 0 :(得分:0)

您可以对st_approximatemedialaxis()的输出进行后期处理,以通过某些标准(例如,点数)过滤掉这些尾巴:

select st_astext(geom)
from (select (st_dump(x.geom)).geom
    from (values (st_geomfromtext('MULTILINESTRING( (27 80, 18 68, 29 48, 55 58, 53 76, 27 80), (55 58, 58 57))')),
    (st_geomfromtext('MULTILINESTRING( (46 34, 32 21, 44 7, 67 9, 67 29, 46 34), (46 34, 46 36))')),
    (st_geomfromtext('MULTILINESTRING( (69 66, 61 48, 75 40, 94 54, 88 68, 69 66), (61 48, 58 47))'))) as x(geom)) y
where st_npoints(geom)>2

返回

LINESTRING(27 80,18 68,29 48,55 58,53 76,27 80)
LINESTRING(46 34,32 21,44 7,67 9,67 29,46 34)
LINESTRING(69 66,61 48,75 40,94 54,88 68,69 66)