Opened 6 years ago

Closed 6 years ago

Last modified 6 years ago

#4211 closed defect (fixed)

ST_Subdivide() on geometries with rings

Reported by: morena Owned by: komzpa
Priority: high Milestone: PostGIS 2.5.1
Component: postgis Version: 2.5.x -- EOL
Keywords: ST_Subdivide Cc:

Description

The ST_Subdivide() function on PostGIS 2.5.0 yields incorrect results for geometries (POLYGON) with rings (wholes).

To reproduce the issue:

DROP TABLE IF EXISTS test_geom;
CREATE TABLE test_geom AS 
SELECT ST_GeomFromText('MULTIPOLYGON(((-88.2059 41.7325,-88.2060 41.7244,-88.1959 41.7241,-88.1959 41.7326,-88.2059 41.7325),(-88.1997 41.7289,-88.1996 41.7285,-88.1990 41.7285,-88.1990 41.7289,-88.1997 41.7289)))',4326) AS geom;

DROP TABLE IF EXISTS test_geom_result;
CREATE TABLE test_geom_result AS
SELECT ST_Subdivide(geom) AS geom FROM test_geom;

Attached are the previews of the above.

View of test geometry (on either PostGIS 2.4.4 or PostGIS 2.5.0):

View of result on PostGIS 2.4.4:

View of result on PostGIS 2.5.0:

The two outputs were tested on following setup: PostGIS 2.4.4

SELECT PostGIS_Full_Version();
POSTGIS="2.4.4 r16526" PGSQL="100" GEOS="3.7.0dev-CAPI-1.11.0 r" PROJ="Rel. 4.9.3, 15 August 2016" GDAL="GDAL 2.1.2, released 2016/10/24" LIBXML="2.9.4" LIBJSON="0.12.1" RASTER

PostGIS 2.5.0

SELECT PostGIS_Full_Version();
POSTGIS="2.5.0 r16836" [EXTENSION] PGSQL="110" GEOS="3.7.0-CAPI-1.11.0 673b9939" PROJ="Rel. 4.9.3, 15 August 2016" GDAL="GDAL 2.3.2, released 2018/09/21" LIBXML="2.9.4" LIBJSON="0.12.1" RASTER

Attachments (3)

test_geom.png (125.2 KB ) - added by morena 6 years ago.
postgis_2.4.4_test_geom_result.png (135.2 KB ) - added by morena 6 years ago.
postgis_2.5.0_test_geom_result.png (122.6 KB ) - added by morena 6 years ago.

Download all attachments as: .zip

Change History (11)

by morena, 6 years ago

Attachment: test_geom.png added

by morena, 6 years ago

by morena, 6 years ago

comment:1 by komzpa, 6 years ago

Cannot reproduce.

Result I get:

POLYGON((-88.2059 41.7325,-88.206 41.7244,-88.1959 41.7241,-88.1959 41.7326,-88.2059 41.7325),(-88.1997 41.7289,-88.1996 41.7285,-88.199 41.7285,-88.199 41.7289,-88.1997 41.7289))

is expected, as your geometry is already below default 256 points. What are you using for rendering? May it happen interior ring is lost somewhere else in the process?

 POSTGIS="2.5.0 r16836" [EXTENSION] PGSQL="110" GEOS="3.6.2-CAPI-1.10.2 4d2925d6" PROJ="Rel. 5.1.0, June 1st, 2018" GDAL="GDAL 2.3.2, released 2018/09/21" LIBXML="2.9.4" LIBJSON="0.12.1" LIBPROTOBUF="1.3.1" RASTER

comment:2 by komzpa, 6 years ago

Owner: changed from pramsey to komzpa
Priority: mediumhigh

with ST_Subdivide(geom, 8) I am able to reproduce the issue.

comment:4 by komzpa, 6 years ago

with fix: https://user-images.githubusercontent.com/810638/47295987-af65a200-d619-11e8-937f-d02e76a407a1.png

comment:5 by komzpa, 6 years ago

Resolution: fixed
Status: newclosed

In 16937:

ST_Subdivide: support rect hole in rect shell

Closes #4211
Closes https://github.com/postgis/postgis/pull/317

comment:6 by komzpa, 6 years ago

In 16938:

ST_Subdivide: support rect hole in rect shell

Closes #4211
Closes https://github.com/postgis/postgis/pull/317

comment:7 by komzpa, 6 years ago

morena, please try updating from latest branch and check that your data is all OK now. The case you reported should be OK starting from PostGIS 2.5.1.

comment:8 by morena, 6 years ago

Latest branch indeed fixed the issue. Thank you!

Note: See TracTickets for help on using tickets.