Database Reference
In-Depth Information
Finally,puttheroofandflooronourbuilding,usingtheoriginalgeometryforthefloor
(forcedto3D)andacopyoftheoriginalgeometrytranslatedtoourinputheight,as
follows:
buildingTop AS
(
SELECT ST_Translate(ST_Force3DZ($1), 0, 0,
$2) AS the_geom
),
buildingBottom AS
(
SELECT ST_Translate(ST_Force3DZ($1), 0, 0, 0)
AS the_geom
),
Weputthewalls,roof,andfloortogetherand,duringtheprocess,convertthistoa
3D multipolygon:
wholeBuilding AS
(
SELECT the_geom FROM buildingBottom
UNION ALL
SELECT the_geom FROM threeDwall
UNION ALL
SELECT the_geom FROM buildingTop
),
multiBuilding AS
(
SELECT ST_Multi(ST_Collect(the_geom)) AS
the_geom FROM wholeBuilding
),
While we could leave our geometry as a multipolygon, we'll do things properly and
munge an informal cast to polyhedralsurface. In our case, we are already effect-
ively formatted as a polyhedralsurface, so we'll just convert our geometry to text
with ST_AsText , replace the word MULTIPOLYGON with POLYHEDRALSURFACE ,
and then convert our text back to geometry with ST_GeomFromText :
Search WWH ::




Custom Search