Opened 3 weeks ago
#5818 new defect
CG_IsSolid(geom) gives the wrong result In PostGIS
Reported by: | nbvfgh | Owned by: | lbartoletti |
---|---|---|---|
Priority: | critical | Milestone: | PostGIS SFCGAL |
Component: | sfcgal | Version: | 3.5.x |
Keywords: | Cc: |
Description
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
Note:
See TracTickets
for help on using tickets.