Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ST_Subdivide: improved handling of polygons with many holes.
Closes #4038 Closes #202 git-svn-id: http://svn.osgeo.org/postgis/trunk@16451 b70326c6-7e19-0410-871a-916f4a2858ee
- Loading branch information
Showing
10 changed files
with
203 additions
and
99 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,28 +1,24 @@ | ||
-- Overlap | ||
SELECT ST_ClipByBox2d(ST_MakeEnvelope(0,0,10,10),ST_MakeEnvelope(5,5,20,20))::box2d; | ||
SELECT '1', ST_ClipByBox2d(ST_MakeEnvelope(0,0,10,10),ST_MakeEnvelope(5,5,20,20))::box2d; | ||
-- Geom covers rect | ||
SELECT ST_ClipByBox2d(ST_MakeEnvelope(0,0,10,10),ST_MakeEnvelope(5,5,8,8))::box2d; | ||
SELECT '2', ST_ClipByBox2d(ST_MakeEnvelope(0,0,10,10),ST_MakeEnvelope(5,5,8,8))::box2d; | ||
-- Geom within rect | ||
SELECT ST_ClipByBox2d(ST_MakeEnvelope(2,2,8,8),ST_MakeEnvelope(0,0,10,10))::box2d; | ||
SELECT '3', ST_ClipByBox2d(ST_MakeEnvelope(2,2,8,8),ST_MakeEnvelope(0,0,10,10))::box2d; | ||
-- Multipoint with point inside, point outside and point on boundary | ||
SELECT ST_AsText(ST_ClipByBox2d('MULTIPOINT(-1 -1, 0 0, 2 2)'::geometry,ST_MakeEnvelope(0,0,10,10))); | ||
-- Invalid polygon (bow-tie) -- ST_Intersection throws an exception here | ||
SELECT ST_AsText(ST_ClipByBox2d('POLYGON((0 0, 10 10, 0 10, 10 0, 0 0))', ST_MakeEnvelope(2,2,8,8))); | ||
SELECT '4', ST_AsText(ST_ClipByBox2d('MULTIPOINT(-1 -1, 0 0, 2 2)'::geometry,ST_MakeEnvelope(0,0,10,10))); | ||
-- Invalid polygon (bow-tie) | ||
SELECT '5', ST_AsText(ST_ClipByBox2d('POLYGON((0 0, 10 10, 0 10, 10 0, 0 0))', ST_MakeEnvelope(2,2,8,8))); | ||
-- Invalid polygon (lineal self-intersection) -- ST_Intersection returns a collection | ||
SELECT ST_AsText(ST_ClipByBox2d('POLYGON((0 0,5 4,5 6,0 10,10 10,5 6,5 4,10 0,0 0))', ST_MakeEnvelope(2,2,10,5))); | ||
SELECT '6', ST_AsText(ST_ClipByBox2d('POLYGON((0 0,5 4,5 6,0 10,10 10,5 6,5 4,10 0,0 0))', ST_MakeEnvelope(2,2,10,5))); | ||
-- Invalid polygon (non-closed ring) -- ST_Intersection raises an exception | ||
-- The HEXWKB represents 'POLYGON((0 0, 10 0, 10 10, 0 10))' | ||
SELECT ST_AsText(ST_ClipByBox2d( | ||
SELECT '7', ST_AsText(ST_ClipByBox2d( | ||
'0103000000010000000400000000000000000000000000000000000000000000000000244000000000000000000000000000002440000000000000244000000000000000000000000000002440' | ||
, ST_MakeEnvelope(2,2,5,5))); | ||
-- Geometry disjoint from box, from a table | ||
-- See http://trac.osgeo.org/postgis/ticket/2950 | ||
CREATE TEMPORARY TABLE t AS SELECT | ||
'SRID=3857;POLYGON((41 20,41 0,21 0,1 20,1 40,21 40,41 20))' | ||
::geometry g; | ||
SELECT ST_AsEWKT(ST_ClipByBox2d(g, ST_MakeEnvelope(-20,-20,-10,-10))) FROM t; | ||
'SRID=3857;POLYGON((41 20,41 0,21 0,1 20,1 40,21 40,41 20))'::geometry g; | ||
SELECT '8', ST_AsEWKT(ST_ClipByBox2d(g, ST_MakeEnvelope(-20,-20,-10,-10))) FROM t; | ||
-- See http://trac.osgeo.org/postgis/ticket/2954 | ||
SELECT ST_AsEWKT(ST_ClipByBox2D('SRID=4326;POINT(0 0)','BOX3D(-1 -1,1 1)'::box3d::box2d)); | ||
|
||
SELECT '#3135', st_astext(ST_SubDivide(ST_GeomFromText('POLYGON((1 2,1 2,1 2,1 2))'), 2)); | ||
|
||
SELECT '9', ST_AsEWKT(ST_ClipByBox2D('SRID=4326;POINT(0 0)','BOX3D(-1 -1,1 1)'::box3d::box2d)); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,13 @@ | ||
BOX(5 5,10 10) | ||
BOX(5 5,8 8) | ||
BOX(2 2,8 8) | ||
POINT(2 2) | ||
POLYGON((2 2,8 2,2 8,8 8,2 2)) | ||
POLYGON((2.5 2,5 4,5 5,5 4,7.5 2,2.5 2)) | ||
POLYGON((2 2,2 5,5 5,5 2,2 2)) | ||
SRID=3857;POLYGON EMPTY | ||
SRID=4326;POINT(0 0) | ||
ERROR: lwgeom_subdivide: cannot subdivide to fewer than 8 vertices per output | ||
1|BOX(5 5,10 10) | ||
2|BOX(5 5,8 8) | ||
3|BOX(2 2,8 8) | ||
4|MULTIPOINT(0 0,2 2) | ||
NOTICE: lwgeom_intersection: GEOS Error: TopologyException: Input geom 0 is invalid: Self-intersection | ||
NOTICE: Self-intersection | ||
NOTICE: Your geometry dataset is not valid per OGC Specification. Please fix it with manual review of entries that are not ST_IsValid(geom). Retrying GEOS operation with ST_MakeValid of your input. | ||
NOTICE: Self-intersection | ||
5|MULTIPOLYGON(((2 2,5 5,8 2,2 2)),((5 5,2 8,8 8,5 5))) | ||
6|MULTIPOLYGON(((2.5 2,5 4,5 5,10 5,10 2,2.5 2))) | ||
7|POLYGON((2 2,2 5,5 5,5 2,2 2)) | ||
8|SRID=3857;POLYGON EMPTY | ||
9|SRID=4326;POINT(0 0) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
\set QUIET on | ||
SET client_min_messages TO WARNING; | ||
drop table if exists big_polygon; | ||
create table big_polygon(geom geometry); | ||
alter table big_polygon alter column geom set storage main; | ||
-- Data (c) OpenStreetMap contributors, ODbL / http://osm.org/ | ||
\copy big_polygon from 'big_polygon.wkb' | ||
\set QUIET off | ||
SET client_min_messages TO NOTICE; |
Oops, something went wrong.