Database Reference
In-Depth Information
Using ST_Extrude to extrude building
footprints
PostGIS2.1broughtalotofreallycooladditionalfunctionalitytoPostGIS.Operation
onPostGISrastertypesareamongthemoreimportantimprovementsthatcomewith
PostGIS 2.1. A quieter and equally potent game changer was the addition of the
SFCGAL library as an optional extension to PostGIS. According to the website
ht-
tp://sfcgal.org/
,SFCGALisaC++wrapperlibraryaroundCGALwiththeaimofsup-
porting ISO 19107:2013 and OGC Simple Features Access 1.2 for 3D operations.
Fromapracticalstandpoint,whatdoesthismean?ItmeansthatPostGISismoving
towardafullyfunctional3Denvironment,withrepresentationofthegeometriesthem-
selves and the operations on those 3D geometries. More information is available at
This and several other recipes will assume that you have a version of PostGIS in-
stalledwithSFCGALcompiledandenabled.Todosoenablesthefollowingfunctions:
•
ST_Extrude
: It extrudes a surface to a related volume
•
ST_StraightSkeleton
: It computes a straight skeleton from a geometry
•
ST_IsPlanar
: It checks whether a surface is a planar or not
•
ST_Orientation
: It determines the surface orientation
•
ST_ForceLHR
: It forces LHR orientation
•
ST_MinkowskiSum
: It computes the Minkowski sum
•
ST_Tesselate
: It performs surface tesselation
For this recipe, we'll use
ST_Extrude
in much the same way we used our own
custom-builtfunctioninthepreviousrecipe,
Constructing and serving buildings 2.5 D
.
TheadvantagetothepreviousrecipeisthatwearenotrequiredtohavetheSFCGAL
librarycompiledinPostGIS.Theadvantagetothisrecipeisthatwehavemorecontrol
over the extrusion process, that is, we can extrude in all three dimensions.
ST_Extrude
returns a geometry, specifically, a polyhedralsurface. It requires four
parameters—aninputgeometryandtheextrusionamountalongtheX,Y,andZaxes: