This article gives a few SQL commands to drape 2D geometries on a DEM (Digital Elevation Model), in order to obtain 3D geometries.
We use PostGIS 2, and its rasters support especially.
Load your DEM
Assuming you have a DEM compatible with GDAL, you can easily load the raster into the database using these commands.
Lately, we were hacking on PostgreSQL (PostGIS) triggers, and we quickly felt
like debugging our code... Here is a cheap and quick way of printing out
triggers variables and context through Django.
PostgreSQL server configuration
In postgresql.conf, adjust the minimum level of notice sent to the client :