1
votes

i'm trying to buffer multipolygon like this

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)))

it contains 4 separated polygons.

when I call

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

i'm geiitng single polygon (actualy first element from multi):

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

any idea how is it posibble to get polygon from buffered multipolygon?

1

1 Answers

1
votes

The multipolygon is not valid.

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)

Invalid geometries have bad implications for calculations, such as buffer. There is no point in picking apart your results any further.