来自multipolygon的postgis st_buffer返回多边形

时间:2013-11-28 12:12:20

标签: postgis

我试图像这样缓冲多边形

MULTIPOLYGON(((18.601741790771 54.355655947711,18.613586425781 54.356856362498,18.616676330566 54.353855259767,18.601913452148 54.353255012915,18.601741790771 54.355655947711),(18.654441833496 54.360357371971,18.656673431396 54.366558427837,18.667144775391 54.3662583983,18.667659759521 54.36025734727,18.654441833496 54.360357371971),(18.71057510376 54.344750573821,18.719329833984 54.344750573821,18.720188140869 54.341748586892,18.707656860352 54.342449070119,18.71057510376 54.344750573821),(18.590068817139 54.344050129814,18.604831695557 54.344150193975,18.603458404541 54.339146687545,18.585090637207 54.340047363647,18.590068817139 54.344050129814)))

它包含4个分开的多边形。

当我打电话

select st_astext( gis.st_Buffer( gis.ST_GeomFromText( 'MULTIPOLYGON(((18.601741790771 54.355655947711,18.613586425781 54.356856362498,18.616676330566 54.353855259767,18.601913452148 54.353255012915,18.601741790771 54.355655947711),(18.654441833496 54.360357371971,18.656673431396 54.366558427837,18.667144775391 54.3662583983,18.667659759521 54.36025734727,18.654441833496 54.360357371971),(18.71057510376 54.344750573821,18.719329833984 54.344750573821,18.720188140869 54.341748586892,18.707656860352 54.342449070119,18.71057510376 54.344750573821),(18.590068817139 54.344050129814,18.604831695557 54.344150193975,18.603458404541 54.339146687545,18.585090637207 54.340047363647,18.590068817139 54.344050129814)))' ) ,0) ) as buffer

我是geiitng单一多边形(来自multi的实际第一个元素):

POLYGON((18.601741790771 54.355655947711,18.613586425781 54.356856362498,18.616676330566 54.353855259767,18.601913452148 54.353255012915,18.601741790771 54.355655947711))

任何想法如何从缓冲的多边形中获取多边形?

1 个答案:

答案 0 :(得分:1)

多面无效。

SELECT ST_IsValid(geom), ST_IsValidReason(geom)
FROM (
 SELECT 'MULTIPOLYGON(((18.601741790771 54.355655947711,18.613586425781 54.356856'
        '362498,18.616676330566 54.353855259767,18.601913452148 54.353255012915,'
        '18.601741790771 54.355655947711),(18.654441833496 54.360357371971,18.656'
        '673431396 54.366558427837,18.667144775391 54.3662583983,18.667659759521 '
        '54.36025734727,18.654441833496 54.360357371971),(18.71057510376 54.34475'
        '0573821,18.719329833984 54.344750573821,18.720188140869 54.341748586892,'
        '18.707656860352 54.342449070119,18.71057510376 54.344750573821),(18.5900'
        '68817139 54.344050129814,18.604831695557 54.344150193975,18.603458404541'
        ' 54.339146687545,18.585090637207 54.340047363647,18.590068817139 54.3440'
        '50129814)))'::geometry AS geom
) AS f;
NOTICE:  Hole lies outside shell at or near point 18.654441833496001 54.360357371970998

 st_isvalid |                     st_isvalidreason
------------+----------------------------------------------------------
 f          | Hole lies outside shell[18.654441833496 54.360357371971]
(1 row)

无效的几何具有bad implications for calculations, such as buffer。没有必要再将结果分开。