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

Sieve: avoid feeding non-polygons into ST_DumpRings #20

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions postgis-vt-util.sql
Original file line number Diff line number Diff line change
Expand Up @@ -439,7 +439,7 @@ $func$
with exploded as (
-- First use ST_Dump to explode the input multipolygon
-- to individual polygons.
select (ST_Dump(g)).geom
select (ST_Dump(ST_CollectionExtract(g, 3))).geom
), rings as (
-- Next use ST_DumpRings to turn all of the inner and outer rings
-- into their own separate polygons.
Expand All @@ -459,7 +459,7 @@ $func$
with exploded as (
-- First use ST_Dump to explode the input multipolygon
-- to individual polygons.
select (ST_Dump(g)).geom
select (ST_Dump(ST_CollectionExtract(g, 3))).geom
), rings as (
-- Next use ST_DumpRings to turn all of the inner and outer rings
-- into their own separate polygons.
Expand Down
4 changes: 2 additions & 2 deletions src/Sieve.sql
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ $func$
with exploded as (
-- First use ST_Dump to explode the input multipolygon
-- to individual polygons.
select (ST_Dump(g)).geom
select (ST_Dump(ST_CollectionExtract(g, 3))).geom
), rings as (
-- Next use ST_DumpRings to turn all of the inner and outer rings
-- into their own separate polygons.
Expand All @@ -37,7 +37,7 @@ $func$
with exploded as (
-- First use ST_Dump to explode the input multipolygon
-- to individual polygons.
select (ST_Dump(g)).geom
select (ST_Dump(ST_CollectionExtract(g, 3))).geom
), rings as (
-- Next use ST_DumpRings to turn all of the inner and outer rings
-- into their own separate polygons.
Expand Down
7 changes: 7 additions & 0 deletions test/sql-test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,13 @@ tf ST_AsText "Sieve(ST_GeomFromText('MULTIPOLYGON(\
((200 200,200 202,202 202,202 200,200 200)),\
((300 300,300 350,350 350,350 300,300 300)))'),10)" \
"MULTIPOLYGON(((0 0,0 100,100 100,100 0,0 0),(50 50,60 50,60 60,50 60,50 50)),((300 300,300 350,350 350,350 300,300 300)))"
tf ST_AsText "Sieve(ST_GeomFromText('GEOMETRYCOLLECTION(\
LINESTRING(-10 -10, -10 -100),\
MULTIPOLYGON(\
((0 0,0 100,100 100,100 0,0 0),(10 10,12 10,12 12,10 12,10 10),(50 50,60 50,60 60,50 60,50 50)),\
((200 200,200 202,202 202,202 200,200 200)),\
((300 300,300 350,350 350,350 300,300 300))))'),10)" \
"MULTIPOLYGON(((0 0,0 100,100 100,100 0,0 0),(50 50,60 50,60 60,50 60,50 50)),((300 300,300 350,350 350,350 300,300 300)))"

# SmartShrink
tf floor "ST_Area(SmartShrink(ST_Buffer(ST_MakePoint(0,0),5000),0.5,true))" \
Expand Down