Opened 10 years ago

Closed 10 years ago

#2818 closed defect (fixed)

ST_Extrude can't extrude all polygons

Reported by: robe Owned by: colivier
Priority: medium Milestone: PostGIS SFCGAL
Component: sfcgal Version: master
Keywords: Cc:

Description

I'm not sure if this is perhaps something that has to be noted in the docs about setting directions of holes or perhaps ST_Extrude just doesn't work with polygons that have holes or I have to force it in a particular direction.

I tried to extrude this polygon with holes which ST_IsValid says is valid

SELECT ST_Extrude('POLYGON(
(-0.25 -1.25,-0.25 1.25,2.5 1.25,2.5 -1.25,-0.25 -1.25),
(2.25 0,1.25 1,1.25 -1,2.25 0),(1 -1,1 1,0 0,1 -1))'::geometry, 0,0,1)

and got the message:

NOTICE:  During extrude(A, 0, 0, 1) :
NOTICE:    with A: POLYGON((-1/4 -5/4,-1/4 5/4,5/2 5/4,5/2 -5/4,-1/4 -5/4),(9/4 0/1,5/4 1/1,5/4 -1/1,9/4 0/1),(1/1 -1/1,1/1 1/1,0/1 0/1,1/1 -1/1))


ERROR:  Polygon is invalid : interior ring 0 is oriented in the same direction as exterior ring : POLYGON((-1/4 -5/4 0/1,5/2 -5/4 0/1,5/2 5/4 0/1,-1/4 5/4 0/1,-1/4 -5/4 0/1),(9/4 0/1 0/1,5/4 1/1 0/1,5/4 -1/1 0/1,9/4 0/1 0/1),(1/1 -1/1 0/1,1/1 1/1 0/1,0/1 0/1 0/1,
********** Error **********

ERROR: Polygon is invalid : interior ring 0 is oriented in the same direction as exterior ring : POLYGON((-1/4 -5/4 0/1,5/2 -5/4 0/1,5/2 5/4 0/1,-1/4 5/4 0/1,-1/4 -5/4 0/1),(9/4 0/1 0/1,5/4 1/1 0/1,5/4 -1/1 0/1,9/4 0/1 0/1),(1/1 -1/1 0/1,1/1 1/1 0/1,0/1 0/1 0/1,

I also tried applying the sfcgal ST_ForceLHR call to see if that would ameliorate the directional issue, but it did not. http://postgis.net/docs/manual-dev/ST_ForceLHR.html

Then I tried the long available ST_ForceRHR and that also did not change the result. http://postgis.net/docs/manual-dev/ST_ForceRHR.html

Change History (4)

comment:1 by vmo, 10 years ago

That was a bug in SFCGAL, fixed in change-set bfea527.

The erroneous implementation was forcing exterior rings to be CCW and interior ring to be CW, except that it only worked for exterior. As a result the input polygon (CW ext and CCW int) was rendered invalid.

comment:2 by robe, 10 years ago

Milestone: PostGIS 2.2.0PostGIS SFCGAL

I've added an SFCGAL milestone then similar to what we have for GEOS/GDAL/PostgreSQL when its something that has to be fixed outside of PostGIS code base.

So this would be considered fixed in SFCGAL 1.0.5 right when that gets tagged and we can close out at that point.

In meantime will build master to further test.

comment:3 by smathermather, 10 years ago

Checked out bfea527, and tested on Ubuntu 14.04 64-bit:

POSTGIS="2.2.0dev r12973" GEOS="3.4.2-CAPI-1.8.2 r3921" SFCGAL="1.0.5" PROJ="Rel. 4.8.0, 6 March 2012" GDAL="GDAL 1.10.1, released 2013/08/26" LIBXML="2.9.1" LIBJSON="0.11.99" RASTER

It works there.

comment:4 by robe, 10 years ago

Resolution: fixed
Status: newclosed

great. I'll close this out then.

Note: See TracTickets for help on using tickets.