[PostGIS] #5818: CG_IsSolid(geom) gives the wrong result In PostGIS
PostGIS
trac at osgeo.org
Thu Dec 5 23:59:49 PST 2024
#5818: CG_IsSolid(geom) gives the wrong result In PostGIS
----------------------+----------------------------
Reporter: nbvfgh | Owner: lbartoletti
Type: defect | Status: new
Priority: critical | Milestone: PostGIS SFCGAL
Component: sfcgal | Version: 3.5.x
Keywords: |
----------------------+----------------------------
We perform the following query on a closed polyhedralsurface:
{{{
WITH polyhedralsurface AS (
SELECT
'POLYHEDRALSURFACE Z (((-1 1 -1,1 1 -1,1 -1 -1,-1 -1 -1,-1 1 -1)),
((-1 1 1,-1 -1 1,1 -1 1,1 1 1,-1 1 1)),
((-1 1 -1,-1 1 1,1 1 1,1 1 -1,-1 1 -1)),
((1 1 -1,1 1 1,1 -1 1,1 -1 -1,1 1 -1)),
((1 -1 -1,1 -1 1,-1 -1 1,-1 -1 -1,1 -1 -1)),
((-1 -1 -1,-1 -1 1,-1 1 1,-1 1 -1,-1 -1
-1)))'
geom
)
SELECT
CG_IsSolid(geom),
ST_IsClosed(geom),
CG_Volume(geom)
FROM polyhedralsurface
-- result : {f,t,0}
}}}
But when we converted this polyhedralsurface into a solid, we obtained an
unexpected result
{{{
WITH solid AS (
SELECT CG_MakeSolid(
'POLYHEDRALSURFACE Z (((-1 1 -1,1 1 -1,1 -1 -1,-1 -1 -1,-1 1 -1)),
((-1 1 1,-1 -1 1,1 -1 1,1 1 1,-1 1 1)),
((-1 1 -1,-1 1 1,1 1 1,1 1 -1,-1 1 -1)),
((1 1 -1,1 1 1,1 -1 1,1 -1 -1,1 1 -1)),
((1 -1 -1,1 -1 1,-1 -1 1,-1 -1 -1,1 -1 -1)),
((-1 -1 -1,-1 -1 1,-1 1 1,-1 1 -1,-1 -1
-1)))'
) geom
)
SELECT
CG_IsSolid(geom),
ST_IsClosed(geom),
CG_Volume(geom)
FROM solid;
-- expected : {t,t,8};
-- actual : {f,t,8};
}}}
It should be noted that, CG_Volume(geom) computes the volume of a 3D
solid,and if it applied to surface (even closed) geometries will return 0.
Its return value is 8 here, indicating that geom is not a surface, while
CG_IsSolid(geom) returns false. So what type of geometry is geom?
Version Info:
{{{
POSTGIS="3.5.0 3.5.0" [EXTENSION] PGSQL="170" GEOS="3.13.0-CAPI-1.19.0"
SFCGAL="SFCGAL 1.5.2, CGAL 5.6.1, BOOST 1.84.0" PROJ="8.2.1
NETWORK_ENABLED=OFF URL_ENDPOINT=https://cdn.proj.org
USER_WRITABLE_DIRECTORY=C:\WINDOWS\ServiceProfiles\NetworkService\AppData\Local/proj
DATABASE_PATH=C:\Program
Files\PostgreSQL\16\share\contrib\postgis-3.4\proj\proj.db" (compiled
against PROJ 8.13.0) LIBXML="2.12.5" LIBJSON="0.12" LIBPROTOBUF="1.2.1"
WAGYU="0.5.0 (Internal)" TOPOLOGY
}}}
--
Ticket URL: <https://trac.osgeo.org/postgis/ticket/5818>
PostGIS <http://trac.osgeo.org/postgis/>
The PostGIS Trac is used for bug, enhancement & task tracking, a user and developer wiki, and a view into the subversion code repository of PostGIS project.
More information about the postgis-tickets
mailing list