postgres-impl-postgis-3d-raster
postgres-impl-postgis-3d-raster
Quick Reference :
PostGIS splits beyond planar vector geometry into two extra worlds, each behind its own extension. 3D solids and volumetric operations live in postgis_sfcgal (the SFCGAL backend). Gridded / raster data (elevation models, satellite imagery) lives in postgis_raster. A third extension, postgis_topology, models shared-boundary networks. None of these three is enabled by CREATE EXTENSION postgis alone : you must install each one explicitly.
The single most misunderstood point : NOT every ST_3D* function needs postgis_sfcgal. The 3D distance / intersection family (ST_3DDistance, ST_3DIntersects, ST_3DDWithin, ST_3DClosestPoint) is CORE PostGIS in 3.x : their SFCGAL implementations were removed in PostGIS 3.0.0 and replaced by the GEOS backend. They work with only CREATE EXTENSION postgis. What genuinely needs postgis_sfcgal is the SOLID and surface-construction family : ST_Volume, ST_3DArea, ST_Extrude, ST_MakeSolid, ST_IsSolid, ST_Tesselate, ST_3DConvexHull. Calling one of those without the extension raises SQLSTATE 42883 (undefined_function).
For raster, the dominant decision is in-db versus out-db storage. In-db stores pixels inside the table : fast pixel math, but a few large images bloat the table catastrophically. Out-db (raster2pgsql -R) stores only a file path plus metadata : no bloat, cloud-friendly, but needs postgis.enable_outdb_rasters turned on. ALWAYS tile rasters with raster2pgsql -t regardless of storage mode : an untiled raster is a single multi-gigabyte row. The data-model rule : continuous fields (elevation, temperature) are raster ; discrete features (parcels, roads) are vector.