Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Buffer op throws exception for multipolygon #1182

Open
mwtoews opened this issue Oct 18, 2024 · 0 comments
Open

Buffer op throws exception for multipolygon #1182

mwtoews opened this issue Oct 18, 2024 · 0 comments
Labels

Comments

@mwtoews
Copy link
Contributor

mwtoews commented Oct 18, 2024

This issue was reported here: shapely/shapely#2174

It involves valid polygons (p1 in blue and p2 in red) and their valid multipolygon (mp).
image

$ cat > p1.wkb
0103000000010000001F0000001C5F7B660033E7409947FE60CC0FE7C0535A7FCB1E2AE740F75B3BD1F214E7C0DE753664781AE7408D2782389924E7C009C4EBFA9F91E7403CDA386209F3E7C01D5A643B6296E54058A835CDBD61EBC033333333A3B1E5403F8D7B738732EBC033333333A3B1E540FAB9A1296AE8EAC03333333343BBE54000000000C0D7EAC033333333A3B1E5400000000000C7EAC033333333A3B1E54066666666262EE9C033333333C3BEE54066666666262EE9C033333333C3BEE54066666666A6CBE8C0DD7BB8E46201E54021567F04605EE8C0DD7BB8E46201E540417DCB9C882DE8C0DD7BB8E46201E540A6272CF18814E8C06688635D4397E440A6272CF18814E8C030F0DC7BA6D8E1406D567DAE1FD3EAC030F0DC7BA6D8E14011363CBD9E1AEBC020D26F5FA6F1E14011363CBD9E1AEBC06666666606EFE1402BDEC83CB91AEBC06666666606EFE14058A835CDBD61EBC022FAB5F5B3D999C058A835CDBD61EBC06F48A30287EC99C0C95702A97942EBC0EC51B81E85049AC000000000A01AEBC03F1C244489949AC000000000A01AEBC03F1C244489949AC011363CBD9E1AEBC05A80B6D58C7097C011363CBD9E1AEBC093A641D18C7497C0FD135CACBFD3EAC0F1B73D410AD1BBC0A6272CF18814E8C0008E3D7B0623BFC0A6272CF18814E8C01C5F7B660033E7409947FE60CC0FE7C0
$ cat > p2.wkb
01030000000100000007000000B7EEE6A92235E5400ABFD4CFE44DE9C0E4DA503103BEE440202922C3DE18EBC0D8800871B4BDE4402E8ECACD0C1AEBC06C09F9A006BEE440172CD585D118EBC0A2D3F3EE47BEE440E962D3CABD17EBC0193735D04DBEE440A06B5F40BF17EBC0B7EEE6A92235E5400ABFD4CFE44DE9C0
$ cat > mp.wkb
0106000000020000000103000000010000001F0000001C5F7B660033E7409947FE60CC0FE7C0535A7FCB1E2AE740F75B3BD1F214E7C0DE753664781AE7408D2782389924E7C009C4EBFA9F91E7403CDA386209F3E7C01D5A643B6296E54058A835CDBD61EBC033333333A3B1E5403F8D7B738732EBC033333333A3B1E540FAB9A1296AE8EAC03333333343BBE54000000000C0D7EAC033333333A3B1E5400000000000C7EAC033333333A3B1E54066666666262EE9C033333333C3BEE54066666666262EE9C033333333C3BEE54066666666A6CBE8C0DD7BB8E46201E54021567F04605EE8C0DD7BB8E46201E540417DCB9C882DE8C0DD7BB8E46201E540A6272CF18814E8C06688635D4397E440A6272CF18814E8C030F0DC7BA6D8E1406D567DAE1FD3EAC030F0DC7BA6D8E14011363CBD9E1AEBC020D26F5FA6F1E14011363CBD9E1AEBC06666666606EFE1402BDEC83CB91AEBC06666666606EFE14058A835CDBD61EBC022FAB5F5B3D999C058A835CDBD61EBC06F48A30287EC99C0C95702A97942EBC0EC51B81E85049AC000000000A01AEBC03F1C244489949AC000000000A01AEBC03F1C244489949AC011363CBD9E1AEBC05A80B6D58C7097C011363CBD9E1AEBC093A641D18C7497C0FD135CACBFD3EAC0F1B73D410AD1BBC0A6272CF18814E8C0008E3D7B0623BFC0A6272CF18814E8C01C5F7B660033E7409947FE60CC0FE7C001030000000100000007000000B7EEE6A92235E5400ABFD4CFE44DE9C0E4DA503103BEE440202922C3DE18EBC0D8800871B4BDE4402E8ECACD0C1AEBC06C09F9A006BEE440172CD585D118EBC0A2D3F3EE47BEE440E962D3CABD17EBC0193735D04DBEE440A06B5F40BF17EBC0B7EEE6A92235E5400ABFD4CFE44DE9C0

Firstly, the negative buffer Op works on the individual polygons:

$ ./geosop -a p1.wkb buffer N-1
POLYGON ((-1664 ...
$ ./geosop -a p2.wkb buffer N-1
POLYGON EMPTY

But crashes with the multipolygon:

$ ./geosop -a mp.wkb buffer N-1
Run-time exception: TopologyException: unable to assign hole to a shell

This is a regression, as GEOS 3.11.0 handles mp as expected. It is broken from 3.11.1 thru to 3.13.0 and main branch.

Doing a few bisections, the break is from 6297b6a via #707

I should also briefly note that with JTS, this issue sort-of works. It handles each p1 and p2 as expected, but the mp version appears to snap-round the coordinates to the nearest 10, indicating this a separate issue.

@dr-jts dr-jts changed the title Buffer operations throws exceptions for multipolygon Buffer op throws exception for multipolygon Nov 25, 2024
@dr-jts dr-jts added the Bug label Nov 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants