CG_GenerateFlatRoof
Name
CG_GenerateFlatRoof — Generate a flat (box) roof from a footprint polygon.
Synopsis
geometry
CG_GenerateFlatRoof
(
geometry
geom
, float8
height
)
;
Description
Generate a flat (box-shaped) roof as a 3D
PolyhedralSurface Z
from a 2D footprint polygon.
The roof height above the ground plane is given by
height
(default 3.0).
Availability: 3.7.0 - requires SFCGAL >= 2.3.0.
This method needs SFCGAL backend.
This function supports Polyhedral surfaces.
Examples
Generate a flat roof two units above a rectangular footprint.
Code
WITH data AS ( SELECT 'POLYGON((0 0,5 0,5 4,0 4,0 0))'::geometry AS footprint ) SELECT CG_GenerateFlatRoof(footprint, 2.0) AS roof FROM data;
Output
POLYHEDRALSURFACE Z (((0 0 0,0 4 0,5 4 0,5 0 0,0 0 0)),((0 0 2,5 0 2,5 4 2,0 4 2,0 0 2)),((0 0 0,0 0 2,0 4 2,0 4 0,0 0 0)),((0 4 0,0 4 2,5 4 2,5 4 0,0 4 0)),((5 4 0,5 4 2,5 0 2,5 0 0,5 4 0)),((5 0 0,5 0 2,0 0 2,0 0 0,5 0 0)))