Database Reference
In-Depth Information
textBuilding AS
(
SELECT ST_AsText(the_geom) textbuilding FROM
multiBuilding
),
textBuildSurface AS
(
SELECT ST_GeomFromText(replace(textbuilding,
'MULTIPOLYGON', 'POLYHEDRALSURFACE')) AS
the_geom FROM textBuilding
)
SELECT the_geom FROM textBuildSurface;
Finally, the entire function is as follows:
CREATE OR REPLACE FUNCTION
chp07.threedbuilding(footprint geometry, height
numeric)
RETURNS geometry AS
$BODY$
-- make our polygons into lines, and then chop
up into individual line segments
WITH simple_lines AS
(
SELECT 1 AS gid,
ST_MakeLine(ST_PointN(the_geom,pointn),ST_PointN(the_geom,pointn+1))
AS the_geom
FROM (SELECT 1 AS gid,
chp02.polygon_to_line($1) AS the_geom ) AS a
LEFT JOIN
(SELECT 1 AS gid, generate_series(1,
ST_NumPoints(chp02.polygon_to_line($1))-1) AS
pointn
) AS b
ON a.gid = b.gid
),
Search WWH ::




Custom Search