Opened 7 years ago

Closed 3 years ago

#1973 closed defect (fixed)

st_concavehull() returns sometimes empty geometry collection

Reported by: tolke Owned by: robe
Priority: medium Milestone: PostGIS 2.2.4
Component: postgis Version: 2.0.x
Keywords: concave hull st_concavehull points_as_polygon Cc:

Description

Executing the test query below shows that st_concavehull() returns sometimes an empty (and thus incorrect) polygon. For demonstration, the st_extent() is returned which is also empty in this case.

---

DROP TABLE IF EXISTS temp;

CREATE TEMPORARY TABLE temp AS SELECT ST_MultipointFromText('MULTIPOINT(-0.1116977 51.4968911,-0.1144059 51.4998103,-0.1145644 51.4997663,-0.1117435 51.4969843,-0.11243 51.4985909,-0.1126424 51.4983149,-0.1095458 51.4983205,-0.1103099 51.4982817,-0.1145062 51.4998847,-0.1124628 51.4988542,-0.1111448 51.5002042,-0.1118638 51.4994708,-0.1125271 51.4997354,-0.1117703 51.5003853,-0.1104727 51.5016664,-0.1106169 51.4982728,-0.1101081 51.4999338,-0.1108346 51.5005757,-0.110639 51.501701,-0.1106653 51.5016968,-0.109791 51.4998492,-0.1129582 51.5000033,-0.1119142 51.4986353,-0.112254 51.4983439,-0.1092107 51.4983322,-0.1107878 51.4983057,-0.1108303 51.4982275,-0.1104942 51.5015336,-0.1107248 51.5001007,-0.110516 51.5008405,-0.1105331 51.5011704,-0.1118708 51.5002901,-0.1115661 51.5001851,-0.111476 51.5002775,-0.1141657 51.4996968,-0.1128279 51.4981607,-0.1107347 51.5016685,-0.1106417 51.5008641,-0.110439 51.5017415,-0.1106903 51.5016875)') AS geom;

SELECT st_extent(geom) FROM temp; -- ok

SELECT st_extent(st_concavehull(geom,.9)) FROM temp; -- empty(!)

After removing the lass three coordinates and executing the query above again, a correct polygon is computed, resulting in an non-empty st_extent().

Btw, points_as_polygon() returns non-empty results.

SELECT postgis_full_version(): "POSTGIS="2.0.1 r9979" GEOS="3.3.5-CAPI-1.7.5" PROJ="Rel. 4.7.1, 23 September 2009" LIBXML="2.6.26""

Please fix this defect :-)

Change History (8)

comment:1 Changed 7 years ago by robe

Owner: changed from pramsey to robe

comment:2 Changed 7 years ago by robe

I'm hoping this will be taken care of once we do #2157

comment:3 Changed 7 years ago by robe

Milestone: PostGIS 2.1.0PostGIS Future

comment:4 Changed 3 years ago by gde

The issue comes from the 1/scale_factor applied to ST_Scale with scale_factor integer in the _st_concavehull() function.

A fix would be to replace scale_factor integer := 1; by scale_factor float := 1;

comment:5 Changed 3 years ago by robe

Milestone: PostGIS FuturePostGIS 2.2.4

comment:6 Changed 3 years ago by robe

In 15219:

st_concavehull() returns sometimes empty geometry collection
references #1973 for PostGIS 2.4 (trunk)

comment:7 Changed 3 years ago by robe

In 15220:

st_concavehull() returns sometimes empty geometry collection
references #1973 for PostGIS 2.3

comment:8 Changed 3 years ago by robe

Resolution: fixed
Status: newclosed

In 15221:

st_concavehull() returns sometimes empty geometry collection
closes #1973 for PostGIS 2.2

Note: See TracTickets for help on using tickets.