3D solid processing for city models — enclosed volume, validation, distance, and measurement of polyhedral solids.
Compatibility Matrix
This table covers all DuckDB releases that have not reached end-of-life, including LTS releases, and shows the 2 most recent patch releases of each. Older patch releases are not listed, but the extension may be available for them as well.
| Platform | 1.5.5 | 1.5.6 | 2.0.0 | 2.0.1 |
|---|---|---|---|---|
| Linux AMD64 | ||||
| Linux ARM64 | ||||
| macOS AMD64 | ||||
| macOS ARM64 | ||||
| Windows AMD64 | ||||
| Windows ARM64 | ||||
| WebAssembly |
Installing and Loading
INSTALL three_d FROM community;
LOAD three_d;
Example
-- Build a 3D solid from WKB (e.g. produced by the cityjson extension) and measure it.
-- ST_3DFromWKB accepts an optional geometry_properties sidecar, which restores the
-- shell structure that WKB alone cannot carry (interior cavities, multi-solid parts).
SELECT
ST_3DVolume(solid) AS volume_m3,
ST_3DSurfaceArea(solid) AS surface_m2,
ST_3DFootprintArea(solid) AS footprint_m2,
ST_3DZMax(solid) - ST_3DZMin(solid) AS height_m,
ST_3DIsClosed(solid) AS closed
FROM (
SELECT ST_3DFromWKB(geometry_lod2_2, geometry_properties_lod2_2) AS solid
FROM buildings
);
-- Validate a solid before measuring it: ST_3DVolume requires a valid solid and
-- raises rather than returning a plausible-looking wrong number.
SELECT ST_3DValidationReport(ST_3DFromWKB(geometry_lod2_2, geometry_properties_lod2_2)) AS report
FROM buildings;
-- 3D distance between two geometries (GEOM_3D, built from WKB with ST_Geom3DFromWKB).
SELECT ST_3DDistance(ST_Geom3DFromWKB(a.wkb), ST_Geom3DFromWKB(b.wkb)) AS gap_m
FROM a, b;
About three_d
three_d (repository duckdb-3d) makes the polyhedral solids in 3D city models —
buildings from CityJSON / 3DBAG, CityParquet, and similar sources — first-class,
queryable values in DuckDB. DuckDB's built-in geometry surface is 2D / simple-features
centric; this extension adds the solid-aware types and functions that 3D workflows need,
on a self-contained C++ kernel (no CGAL/SFCGAL dependency).
Two BLOB-backed logical types:
-
SOLID_3D— closed polyhedral solids, backed by a versioned binary payload that preserves shell/face topology. -
GEOM_3D— general 3D geometry (points, lines, polygons, multis, polyhedral surfaces) for the class-generic accessor, distance, and serialization functions.
Function families (PostGIS-style names, a curated 3D subset). 3D operations use ST_3D*
names so that three_d and DuckDB's spatial extension load together in any order; only
the handful of names spatial does not define stay un-prefixed:
- Import / export:
ST_3DFromWKB,ST_3DTryFromWKB,ST_Geom3DFromWKB,ST_3DGeomFromText,ST_3DAsWKB,ST_3DAsText,ST_3DAsGeoJSON,ST_3DAsBinary - Introspection:
ST_3DBounds,ST_3DNumSolids,ST_3DNumShells,ST_3DNumFaces,ST_3DGeometryType,ST_3DDimension,ST_3DNumGeometries,ST_3DHasZ,ST_3DX,ST_3DY,ST_3DZ,ST_3DXMin…ST_3DZMax,ST_3DEnvelope,ST_3DExtent(aggregate),ST_NDims,ST_CoordDim,ST_IsPlanar - Faces and shells:
ST_3DFaces,ST_3DFaceN,ST_3DGeometryN,ST_3DExteriorShell,ST_3DInteriorShellN,ST_3DNumInteriorShells,ST_3DFaceAreas,ST_3DFaceNormals,ST_3DFaceSlopes,ST_3DFaceAzimuths - Validation:
ST_3DIsValid,ST_3DIsClosed,ST_3DIsManifold,ST_3DIsOriented,ST_3DValidationReport - Measurement:
ST_3DVolume,ST_3DSurfaceArea/ST_3DArea,ST_3DFootprintArea,ST_3DPerimeter,ST_3DLength - Distance:
ST_3DDistance,ST_3DDWithin,ST_3DMaxDistance,ST_3DDFullyWithin,ST_3DIntersects,ST_3DDisjoint,ST_3DClosestPoint,ST_3DShortestLine - Transform / construct:
ST_3DTranslate,ST_3DScale,ST_3DRotateX,ST_3DRotateY,ST_3DRotateZ,ST_3DTransform,ST_Force3D,ST_3DConvexHull,ST_3DCentroid,ST_3DExtrude,ST_MakeSolid,ST_3DFootprintHull,ST_3DPlaceImplicit(implicit geometries) - CRS:
ST_3DCRS,ST_3DSRID,ST_3DSetCRS; two-input functions refuse mixed CRSs
Geometry is never silently repaired: validity is reported, and functions with a
precondition raise instead of guessing. ST_3DValidationReport returns the counts
(open edges, non-manifold edges and vertices, degenerate faces, orientation errors,
disconnected shells, self-intersecting faces) behind the verdict. Every function works
under TRY(...), and every parameter can be passed by name.
The constructors accept DuckDB's native GEOMETRY as well as a BLOB of WKB, so a
GeoParquet column can be passed straight to ST_Geom3DFromWKB without a cast.
It composes with the cityjson extension: read CityJSON / CityJSONSeq with
read_cityjson(..., lod => '...') to get a per-LoD geometry_lod* column (WKB) alongside
its geometry_properties_lod* sidecar, then pipe both into ST_3DFromWKB. The extension
is experimental and under active development; APIs and payload formats may change.
Added Functions
| function_name | function_type | description | comment | examples |
|---|---|---|---|---|
| st_3darea | scalar | Returns the 3D area in input units: for a SOLID_3D, ST_3DSurfaceArea (raises on degenerate faces); for a GEOM_3D, the total area of its polygons, holes excluded, and 0 for points and lines. | NULL | [ST_3DArea(ST_3DExtrude(ST_Geom3DFromWKB('POLYGON Z ((0 0 0, 2 0 0, 2 2 0, 0 2 0, 0 0 0))'::GEOMETRY), 3.0))] |
| st_3dasbinary | scalar | Returns a GEOM_3D value as little-endian OGC/ISO WKB with Z. | NULL | [ST_3DAsBinary(ST_Geom3DFromWKB('POINT Z (1 2 3)'::GEOMETRY))] |
| st_3dasgeojson | scalar | Returns a GEOM_3D value as a GeoJSON geometry; a PolyhedralSurface is emitted as a MultiPolygon. | NULL | [ST_3DAsGeoJSON(ST_Geom3DFromWKB('POINT Z (1 2 3)'::GEOMETRY))] |
| st_3dastext | scalar | Returns a GEOM_3D value as ISO WKT with Z; ordinates are formatted with 9 significant digits. | NULL | [ST_3DAsText(ST_Geom3DFromWKB('POINT Z (1 2 3)'::GEOMETRY))] |
| st_3daswkb | scalar | Exports a SOLID_3D as OGC WKB: a PolyhedralSurface Z for one solid, a GeometryCollection Z for a multi-solid. | NULL | [ST_3DAsWKB(ST_3DExtrude(ST_Geom3DFromWKB('POLYGON Z ((0 0 0, 2 0 0, 2 2 0, 0 2 0, 0 0 0))'::GEOMETRY), 3.0))] |
| st_3dbounds | scalar | Returns the 3D bounding box of a SOLID_3D or GEOM_3D value as STRUCT(min_x, min_y, min_z, max_x, max_y, max_z), read from the cached box. | NULL | [ST_3DBounds(ST_3DExtrude(ST_Geom3DFromWKB('POLYGON Z ((0 0 0, 2 0 0, 2 2 0, 0 2 0, 0 0 0))'::GEOMETRY), 3.0))] |
| st_3dcentroid | scalar | Returns the centroid as a Point Z: of a SOLID_3D, its volume's (raises when it encloses none); of a GEOM_3D, area-weighted for surfaces, length-weighted for lines, the vertex average for points. | NULL | [ST_3DCentroid(ST_Geom3DFromWKB('POLYGON Z ((0 0 0, 2 0 0, 2 2 0, 0 2 0, 0 0 0))'::GEOMETRY))] |
| st_3dclosestpoint | scalar | Returns the Point Z on the first GEOM_3D value nearest to the second. | NULL | [ST_3DClosestPoint(ST_Geom3DFromWKB('POLYGON Z ((0 0 0, 2 0 0, 2 2 0, 0 2 0, 0 0 0))'::GEOMETRY), ST_Geom3DFromWKB('POINT Z (4 6 3)'::GEOMETRY))] |
| st_3dconvexhull | scalar | Returns the 3D convex hull of every vertex of a GEOM_3D or SOLID_3D value: a closed PolyhedralSurface Z of convex faces wound outward, so ST_MakeSolid accepts it; coplanar, collinear or single-point input gives a Polygon Z, LineString Z or Point Z. Exact predicates decide every orientation, and the hull's vertices are input vertices. | NULL | [ST_3DConvexHull(ST_Geom3DFromWKB('MULTIPOINT Z (0 0 0, 1 0 0, 0 1 0, 0 0 1)'::GEOMETRY))] |
| st_3dcrs | scalar | Returns the CRS a SOLID_3D or GEOM_3D value is in, such as 'EPSG:28992', or NULL when it has none. It comes from an EWKB SRID or a GEOMETRY column's type, and ST_3DSetCRS sets it. | NULL | [ST_3DCRS(ST_3DSetCRS(ST_Geom3DFromWKB('POINT Z (85000 446800 5)'::GEOMETRY), 'EPSG:28992'))] |
| st_3ddfullywithin | scalar | Returns whether the maximum 3D distance between two GEOM_3D values is within the given distance. A negative distance returns false. | NULL | [ST_3DDFullyWithin(ST_Geom3DFromWKB('POINT Z (1 2 3)'::GEOMETRY), ST_Geom3DFromWKB('POINT Z (4 6 3)'::GEOMETRY), 10.0)] |
| st_3ddimension | scalar | Returns the topological dimension of a GEOM_3D value: 0 for points, 1 for lines, 2 for surfaces. | NULL | [ST_3DDimension(ST_Geom3DFromWKB('POLYGON Z ((0 0 0, 2 0 0, 2 2 0, 0 2 0, 0 0 0))'::GEOMETRY))] |
| st_3ddisjoint | scalar | Returns whether two values share no point in 3D: the negation of ST_3DIntersects, decided exactly. A SOLID_3D is the volume it bounds; an invalid solid raises. | NULL | [ST_3DDisjoint(ST_Geom3DFromWKB('POINT Z (0 0 0)'::GEOMETRY), ST_Geom3DFromWKB('POINT Z (1 2 3)'::GEOMETRY))] |
| st_3ddistance | scalar | Returns the minimum 3D Euclidean distance between two values in input units. A SOLID_3D is the volume it bounds, so a geometry inside it is at distance 0; an invalid solid raises. | NULL | [ST_3DDistance(ST_Geom3DFromWKB('POINT Z (1 2 3)'::GEOMETRY), ST_Geom3DFromWKB('POINT Z (4 6 3)'::GEOMETRY))] |
| st_3ddwithin | scalar | Returns whether two values are within the given 3D distance of each other; prunes on bounding boxes, so it is cheaper than comparing ST_3DDistance. A SOLID_3D is the volume it bounds. A negative distance returns false. | NULL | [ST_3DDWithin(ST_Geom3DFromWKB('POINT Z (1 2 3)'::GEOMETRY), ST_Geom3DFromWKB('POINT Z (4 6 3)'::GEOMETRY), 5.0)] |
| st_3denvelope | scalar | Returns the footprint of a SOLID_3D or GEOM_3D value's bounding box as a 2D GEOMETRY: the rectangle of its X and Y ranges (a line or a point where a range has no width), NULL for an empty value. Its 2D distance to another envelope never exceeds the two values' 3D distance, so spatial's spatial join on ST_DWithin of the envelopes generates every candidate ST_3DDWithin needs. | NULL | [ST_3DEnvelope(ST_3DExtrude(ST_Geom3DFromWKB('POLYGON Z ((0 0 0, 2 0 0, 2 2 0, 0 2 0, 0 0 0))'::GEOMETRY), 3.0))] |
| st_3dextent | aggregate | Aggregate: the 3D bounding box of every SOLID_3D or GEOM_3D value in the group, as ST_3DBounds returns it; NULLs are skipped, and values in different CRSs are refused. | NULL | [ST_3DExtent(geom)] |
| st_3dexteriorshell | scalar | Returns the exterior shell of a SOLID_3D holding one solid as a GEOM_3D PolyhedralSurface, one patch per face, in the solid's CRS; NULL for a collection of solids (take one with ST_3DGeometryN). | NULL | [ST_3DExteriorShell(ST_3DExtrude(ST_Geom3DFromWKB('POLYGON Z ((0 0 0, 2 0 0, 2 2 0, 0 2 0, 0 0 0))'::GEOMETRY), 3.0))] |
| st_3dextrude | scalar | Extrudes a GEOM_3D Polygon vertically by height into a closed, valid SOLID_3D prism. Raises unless the input is a polygon with at least 3 distinct exterior vertices and height > 0. | NULL | [ST_3DExtrude(ST_Geom3DFromWKB('POLYGON Z ((0 0 0, 2 0 0, 2 2 0, 0 2 0, 0 0 0))'::GEOMETRY), 3.0)] |
| st_3dfaceareas | scalar | Returns the area of each face of a SOLID_3D, or each polygon of a GEOM_3D, holes excluded, in face order. They sum to ST_3DSurfaceArea or ST_3DArea. A face that cannot be triangulated is NULL. | NULL | [ST_3DFaceAreas(ST_3DExtrude(ST_Geom3DFromWKB('POLYGON Z ((0 0 0, 2 0 0, 2 2 0, 0 2 0, 0 0 0))'::GEOMETRY), 3.0))] |
| st_3dfaceazimuths | scalar | Returns the azimuth of each face of a SOLID_3D, or each polygon of a GEOM_3D: the compass direction its normal leans toward, in degrees clockwise from +Y (grid north), in [0, 360). NULL for a horizontal face and a face without area. | NULL | [ST_3DFaceAzimuths(ST_3DExtrude(ST_Geom3DFromWKB('POLYGON Z ((0 0 0, 2 0 0, 2 2 0, 0 2 0, 0 0 0))'::GEOMETRY), 3.0))] |
| st_3dfacen | scalar | Returns face n of a SOLID_3D, numbered from 1 as ST_3DFaces numbers them, as a GEOM_3D Polygon in the solid's CRS; NULL when n is out of range or the face cannot be triangulated. | NULL | [ST_3DFaceN(ST_3DExtrude(ST_Geom3DFromWKB('POLYGON Z ((0 0 0, 2 0 0, 2 2 0, 0 2 0, 0 0 0))'::GEOMETRY), 3.0), 1)] |
| st_3dfacenormals | scalar | Returns the unit normal of each face of a SOLID_3D, or each polygon of a GEOM_3D, as STRUCT(x, y, z), following the right-hand rule around the exterior ring: out of a valid solid, into a cavity. NULL for a face without area. | NULL | [ST_3DFaceNormals(ST_3DExtrude(ST_Geom3DFromWKB('POLYGON Z ((0 0 0, 2 0 0, 2 2 0, 0 2 0, 0 0 0))'::GEOMETRY), 3.0))] |
| st_3dfaces | scalar | Returns every face of a SOLID_3D as a list of STRUCT(face, solid, shell, polygon): the face number from 1 in storage order, the solid and the shell within it (1 is the exterior), and the face as a GEOM_3D Polygon in the solid's CRS. A face that cannot be triangulated has a NULL polygon. UNNEST it for one row per face. | NULL | [UNNEST(ST_3DFaces(ST_3DExtrude(ST_Geom3DFromWKB('POLYGON Z ((0 0 0, 2 0 0, 2 2 0, 0 2 0, 0 0 0))'::GEOMETRY), 3.0)))] |
| st_3dfaceslopes | scalar | Returns the slope of each face of a SOLID_3D, or each polygon of a GEOM_3D: its tilt from horizontal in degrees, 0 for horizontal and 90 for vertical, whichever way it faces. NULL for a face without area. | NULL | [ST_3DFaceSlopes(ST_3DExtrude(ST_Geom3DFromWKB('POLYGON Z ((0 0 0, 2 0 0, 2 2 0, 0 2 0, 0 0 0))'::GEOMETRY), 3.0))] |
| st_3dfootprintarea | scalar | Returns the area of a SOLID_3D or GEOM_3D value projected onto the XY plane, in input units. Has no validity precondition. | NULL | [ST_3DFootprintArea(ST_3DExtrude(ST_Geom3DFromWKB('POLYGON Z ((0 0 0, 2 0 0, 2 2 0, 0 2 0, 0 0 0))'::GEOMETRY), 3.0))] |
| st_3dfootprinthull | scalar | Returns the 2D convex hull of a GEOM_3D value's XY projection as a Polygon Z at the input's minimum Z; degenerate inputs give a LineString Z or Point Z. | NULL | [ST_3DFootprintHull(ST_Geom3DFromWKB('LINESTRING Z (0 0 0, 3 4 12)'::GEOMETRY))] |
| st_3dfromwkb | scalar | Builds a SOLID_3D from PolyhedralSurface Z WKB, or a GeometryCollection Z of them for a multi-solid, as BLOB or GEOMETRY; the optional geometry_properties (JSON text or a CityParquet STRUCT) restores the shell grouping WKB cannot carry. Raises on unparseable WKB or unsupported topology. | NULL | [ST_3DFromWKB(ST_3DAsWKB(ST_3DExtrude(ST_Geom3DFromWKB('POLYGON Z ((0 0 0, 2 0 0, 2 2 0, 0 2 0, 0 0 0))'::GEOMETRY), 3.0)))] |
| st_3dgeometryn | scalar | Returns element n (from 1), as PostGIS's ST_GeometryN: of a SOLID_3D its n-th solid, validated on its own; of a GEOM_3D the n-th part of a Multi geometry, the n-th patch of a PolyhedralSurface, or the value itself for n = 1 of a single geometry. NULL when n is out of range. The CRS is kept. | NULL | [ST_3DGeometryN(ST_Geom3DFromWKB('MULTIPOINT Z (1 2 3, 4 5 6)'::GEOMETRY), 2)] |
| st_3dgeometrytype | scalar | Returns the geometry class of a GEOM_3D value, such as 'ST_Point' or 'ST_PolyhedralSurface'. | NULL | [ST_3DGeometryType(ST_Geom3DFromWKB('POLYGON Z ((0 0 0, 2 0 0, 2 2 0, 0 2 0, 0 0 0))'::GEOMETRY))] |
| st_3dgeomfromtext | scalar | Builds a GEOM_3D from 3D WKT: Point, LineString, Polygon, their Multi forms, PolyhedralSurface, and TIN and Triangle, read as the PolyhedralSurface and Polygon they are. An EWKT 'SRID=n;' prefix becomes the CRS 'EPSG:n'. Raises on 2D or M coordinates and on any other class. | NULL | [ST_3DGeomFromText('POLYHEDRALSURFACE Z (((0 0 0, 0 1 0, 1 0 0, 0 0 0)), ((0 0 0, 0 0 1, 0 1 0, 0 0 0)), ((0 0 0, 1 0 0, 0 0 1, 0 0 0)), ((1 0 0, 0 1 0, 0 0 1, 1 0 0)))')] |
| st_3dhasz | scalar | Returns whether a SOLID_3D or GEOM_3D value has Z coordinates, always true. A constant for PostGIS compatibility; the payload is not read. | NULL | [ST_3DHasZ(ST_Geom3DFromWKB('POINT Z (1 2 3)'::GEOMETRY))] |
| st_3dinteriorshelln | scalar | Returns interior shell n (from 1) of a SOLID_3D holding one solid as a GEOM_3D PolyhedralSurface in the solid's CRS, its faces wound into the cavity; NULL when n is out of range or for a collection of solids. | NULL | [ST_3DInteriorShellN(ST_3DExtrude(ST_Geom3DFromWKB('POLYGON Z ((0 0 0, 2 0 0, 2 2 0, 0 2 0, 0 0 0))'::GEOMETRY), 3.0), 1)] |
| st_3dintersects | scalar | Returns whether two values share a point in 3D, decided exactly; touching counts. A SOLID_3D is the volume it bounds; an invalid solid raises. | NULL | [ST_3DIntersects(ST_Geom3DFromWKB('POLYGON Z ((0 0 0, 2 0 0, 2 2 0, 0 2 0, 0 0 0))'::GEOMETRY), ST_Geom3DFromWKB('POINT Z (1 2 3)'::GEOMETRY))] |
| st_3disclosed | scalar | Returns whether every shell of a SOLID_3D value is closed: each undirected edge used exactly twice, in opposing directions. Read from the validation cached at import. | NULL | [ST_3DIsClosed(ST_3DExtrude(ST_Geom3DFromWKB('POLYGON Z ((0 0 0, 2 0 0, 2 2 0, 0 2 0, 0 0 0))'::GEOMETRY), 3.0))] |
| st_3dismanifold | scalar | Returns whether a SOLID_3D value is manifold: no edge belongs to more than two faces, and the faces around each vertex form one fan. Read from the validation cached at import. | NULL | [ST_3DIsManifold(ST_3DExtrude(ST_Geom3DFromWKB('POLYGON Z ((0 0 0, 2 0 0, 2 2 0, 0 2 0, 0 0 0))'::GEOMETRY), 3.0))] |
| st_3disoriented | scalar | Returns whether face winding in a SOLID_3D value is consistent within each shell, with interior shells wound opposite the exterior. Read from the validation cached at import. | NULL | [ST_3DIsOriented(ST_3DExtrude(ST_Geom3DFromWKB('POLYGON Z ((0 0 0, 2 0 0, 2 2 0, 0 2 0, 0 0 0))'::GEOMETRY), 3.0))] |
| st_3disvalid | scalar | Returns whether a SOLID_3D value is valid: ST_3DValidationReport's is_valid, read from the cached verdict. | NULL | [ST_3DIsValid(ST_3DExtrude(ST_Geom3DFromWKB('POLYGON Z ((0 0 0, 2 0 0, 2 2 0, 0 2 0, 0 0 0))'::GEOMETRY), 3.0))] |
| st_3dlength | scalar | Returns the 3D length of a GEOM_3D LineString or MultiLineString in input units, and 0 for any other geometry class. | NULL | [ST_3DLength(ST_Geom3DFromWKB('LINESTRING Z (0 0 0, 3 4 12)'::GEOMETRY))] |
| st_3dmaxdistance | scalar | Returns the maximum 3D Euclidean distance between any two vertices of two GEOM_3D values, in input units. | NULL | [ST_3DMaxDistance(ST_Geom3DFromWKB('POINT Z (1 2 3)'::GEOMETRY), ST_Geom3DFromWKB('POINT Z (4 6 3)'::GEOMETRY))] |
| st_3dnumfaces | scalar | Returns the number of faces across all shells of a SOLID_3D value. Reads the payload header only. | NULL | [ST_3DNumFaces(ST_3DExtrude(ST_Geom3DFromWKB('POLYGON Z ((0 0 0, 2 0 0, 2 2 0, 0 2 0, 0 0 0))'::GEOMETRY), 3.0))] |
| st_3dnumgeometries | scalar | Returns the number of member geometries of a GEOM_3D value: the member count of a Multi geometry, the patch count of a PolyhedralSurface, 1 otherwise. | NULL | [ST_3DNumGeometries(ST_Geom3DFromWKB('POLYGON Z ((0 0 0, 2 0 0, 2 2 0, 0 2 0, 0 0 0))'::GEOMETRY))] |
| st_3dnuminteriorshells | scalar | Returns the number of interior shells (cavities) of a SOLID_3D holding one solid; NULL for a collection of solids. Read from the header. | NULL | [ST_3DNumInteriorShells(ST_3DExtrude(ST_Geom3DFromWKB('POLYGON Z ((0 0 0, 2 0 0, 2 2 0, 0 2 0, 0 0 0))'::GEOMETRY), 3.0))] |
| st_3dnumshells | scalar | Returns the number of shells (exterior and interior) across all solids of a SOLID_3D value. Reads the payload header only. | NULL | [ST_3DNumShells(ST_3DExtrude(ST_Geom3DFromWKB('POLYGON Z ((0 0 0, 2 0 0, 2 2 0, 0 2 0, 0 0 0))'::GEOMETRY), 3.0))] |
| st_3dnumsolids | scalar | Returns the number of solids in a SOLID_3D value: 1 for a solid, more for a multi-solid. Reads the payload header only. | NULL | [ST_3DNumSolids(ST_3DExtrude(ST_Geom3DFromWKB('POLYGON Z ((0 0 0, 2 0 0, 2 2 0, 0 2 0, 0 0 0))'::GEOMETRY), 3.0))] |
| st_3dperimeter | scalar | Returns a 3D perimeter in input units: for a SOLID_3D, the total length of its boundary edges, those used by exactly one face (0 when closed); for a GEOM_3D, as PostGIS, the length of every ring of its polygons, and 0 for points and lines. | NULL | [ST_3DPerimeter(ST_3DExtrude(ST_Geom3DFromWKB('POLYGON Z ((0 0 0, 2 0 0, 2 2 0, 0 2 0, 0 0 0))'::GEOMETRY), 3.0))] |
| st_3dplaceimplicit | scalar | Places an implicit geometry: maps each vertex v of the relative geometry (SOLID_3D or GEOM_3D) to M * v + p, with M the row-major 4x4 transformation matrix (16 values, last row 0 0 0 1; NULL means identity) and p the reference point (a GEOM_3D Point). The result has the input's type; solids are re-validated, and a singular matrix raises for a solid. | NULL | [ST_3DPlaceImplicit(ST_Geom3DFromWKB('POINT Z (1 0 0)'::GEOMETRY), ST_Geom3DFromWKB('POINT Z (10 20 30)'::GEOMETRY), [2.0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 2, 0, 0, 0, 0, 1])] |
| st_3drotatex | scalar | Rotates a SOLID_3D or GEOM_3D value about the X axis by an angle in radians, right-handed and counter-clockwise; the result has the input's type. | NULL | [ST_3DRotateX(ST_Geom3DFromWKB('POINT Z (1 2 3)'::GEOMETRY), pi() / 2)] |
| st_3drotatey | scalar | Rotates a SOLID_3D or GEOM_3D value about the Y axis by an angle in radians, right-handed and counter-clockwise; the result has the input's type. | NULL | [ST_3DRotateY(ST_Geom3DFromWKB('POINT Z (1 2 3)'::GEOMETRY), pi() / 2)] |
| st_3drotatez | scalar | Rotates a SOLID_3D or GEOM_3D value about the Z axis by an angle in radians, right-handed and counter-clockwise; the result has the input's type. | NULL | [ST_3DRotateZ(ST_Geom3DFromWKB('POINT Z (1 2 3)'::GEOMETRY), pi() / 2)] |
| st_3dscale | scalar | Scales a SOLID_3D or GEOM_3D value about the origin by (sx, sy, sz); the result has the input's type. | NULL | [ST_3DScale(ST_Geom3DFromWKB('POINT Z (1 2 3)'::GEOMETRY), 2.0, 2.0, 2.0)] |
| st_3dsetcrs | scalar | Returns the value labelled with the given CRS, such as 'EPSG:28992'; an empty string removes the label. The coordinates are not changed: ST_3DTransform reprojects. | NULL | [ST_3DSetCRS(ST_Geom3DFromWKB('POINT Z (85000 446800 5)'::GEOMETRY), 'EPSG:28992')] |
| st_3dshortestline | scalar | Returns the 2-vertex LineString Z joining the closest points of two GEOM_3D values. | NULL | [ST_3DShortestLine(ST_Geom3DFromWKB('POLYGON Z ((0 0 0, 2 0 0, 2 2 0, 0 2 0, 0 0 0))'::GEOMETRY), ST_Geom3DFromWKB('POINT Z (4 6 3)'::GEOMETRY))] |
| st_3dsrid | scalar | Returns the EPSG code of a value whose CRS is 'EPSG:n', and 0 otherwise (no CRS, or one that is not an EPSG code), as PostGIS reports an unknown SRID. | NULL | [ST_3DSRID(ST_3DSetCRS(ST_Geom3DFromWKB('POINT Z (85000 446800 5)'::GEOMETRY), 'EPSG:28992'))] |
| st_3dsurfacearea | scalar | Returns the total area of all faces of a SOLID_3D value in input units, interior-shell faces included. Raises on degenerate faces. | NULL | [ST_3DSurfaceArea(ST_3DExtrude(ST_Geom3DFromWKB('POLYGON Z ((0 0 0, 2 0 0, 2 2 0, 0 2 0, 0 0 0))'::GEOMETRY), 3.0))] |
| st_3dtransform | scalar | Reprojects a SOLID_3D or GEOM_3D value between CRSs given as EPSG integers or CRS strings; a value that has its own CRS must be in the source. X and Y are reprojected, Z passes through unchanged, and the result is in the target CRS. Solids are re-validated afterwards. | NULL | [ST_3DTransform(ST_Geom3DFromWKB('POINT Z (85000 446800 5)'::GEOMETRY), 28992, 4326)] |
| st_3dtransform | scalar | Reprojects a SOLID_3D or GEOM_3D value from its own CRS (ST_3DCRS; raises when it has none) to a CRS given as an EPSG integer or a CRS string; X and Y are reprojected, Z passes through unchanged, and the result is in the target CRS. Solids are re-validated afterwards. | NULL | [ST_3DTransform(ST_3DSetCRS(ST_Geom3DFromWKB('POINT Z (85000 446800 5)'::GEOMETRY), 'EPSG:28992'), 4326)] |
| st_3dtranslate | scalar | Translates a SOLID_3D or GEOM_3D value by (dx, dy, dz); the result has the input's type. | NULL | [ST_3DTranslate(ST_Geom3DFromWKB('POINT Z (1 2 3)'::GEOMETRY), 10.0, 0.0, -1.0)] |
| st_3dtryfromwkb | scalar | Like ST_3DFromWKB, but returns NULL for a row whose WKB is unparseable or not a solid instead of raising; bind-time errors still raise. | NULL | [ST_3DTryFromWKB('POINT Z (1 2 3)'::GEOMETRY)] |
| st_3dvalidationreport | scalar | Returns a STRUCT reporting a SOLID_3D value's validity: the overall and per-check flags, solid/shell/face counts, per-defect counters, a code ('VALID' or 'INVALID') and a message. | NULL | [ST_3DValidationReport(ST_3DExtrude(ST_Geom3DFromWKB('POLYGON Z ((0 0 0, 2 0 0, 2 2 0, 0 2 0, 0 0 0))'::GEOMETRY), 3.0))] |
| st_3dvolume | scalar | Returns the volume of a SOLID_3D value in input units; interior shells (cavities) subtract and multi-solids sum. Raises unless the solid is closed, manifold, oriented and free of degenerate faces. | NULL | [ST_3DVolume(ST_3DExtrude(ST_Geom3DFromWKB('POLYGON Z ((0 0 0, 2 0 0, 2 2 0, 0 2 0, 0 0 0))'::GEOMETRY), 3.0))] |
| st_3dx | scalar | Returns the X coordinate of a GEOM_3D Point. Raises for any other geometry class. | NULL | [ST_3DX(ST_Geom3DFromWKB('POINT Z (1 2 3)'::GEOMETRY))] |
| st_3dxmax | scalar | Returns the maximum X coordinate of a SOLID_3D or GEOM_3D value, read from its cached bounding box. | NULL | [ST_3DXMax(ST_3DExtrude(ST_Geom3DFromWKB('POLYGON Z ((0 0 0, 2 0 0, 2 2 0, 0 2 0, 0 0 0))'::GEOMETRY), 3.0))] |
| st_3dxmin | scalar | Returns the minimum X coordinate of a SOLID_3D or GEOM_3D value, read from its cached bounding box. | NULL | [ST_3DXMin(ST_3DExtrude(ST_Geom3DFromWKB('POLYGON Z ((0 0 0, 2 0 0, 2 2 0, 0 2 0, 0 0 0))'::GEOMETRY), 3.0))] |
| st_3dy | scalar | Returns the Y coordinate of a GEOM_3D Point. Raises for any other geometry class. | NULL | [ST_3DY(ST_Geom3DFromWKB('POINT Z (1 2 3)'::GEOMETRY))] |
| st_3dymax | scalar | Returns the maximum Y coordinate of a SOLID_3D or GEOM_3D value, read from its cached bounding box. | NULL | [ST_3DYMax(ST_3DExtrude(ST_Geom3DFromWKB('POLYGON Z ((0 0 0, 2 0 0, 2 2 0, 0 2 0, 0 0 0))'::GEOMETRY), 3.0))] |
| st_3dymin | scalar | Returns the minimum Y coordinate of a SOLID_3D or GEOM_3D value, read from its cached bounding box. | NULL | [ST_3DYMin(ST_3DExtrude(ST_Geom3DFromWKB('POLYGON Z ((0 0 0, 2 0 0, 2 2 0, 0 2 0, 0 0 0))'::GEOMETRY), 3.0))] |
| st_3dz | scalar | Returns the Z coordinate of a GEOM_3D Point. Raises for any other geometry class. | NULL | [ST_3DZ(ST_Geom3DFromWKB('POINT Z (1 2 3)'::GEOMETRY))] |
| st_3dzmax | scalar | Returns the maximum Z coordinate of a SOLID_3D or GEOM_3D value, read from its cached bounding box. | NULL | [ST_3DZMax(ST_3DExtrude(ST_Geom3DFromWKB('POLYGON Z ((0 0 0, 2 0 0, 2 2 0, 0 2 0, 0 0 0))'::GEOMETRY), 3.0))] |
| st_3dzmin | scalar | Returns the minimum Z coordinate of a SOLID_3D or GEOM_3D value, read from its cached bounding box. | NULL | [ST_3DZMin(ST_3DExtrude(ST_Geom3DFromWKB('POLYGON Z ((0 0 0, 2 0 0, 2 2 0, 0 2 0, 0 0 0))'::GEOMETRY), 3.0))] |
| st_coorddim | scalar | Returns the coordinate dimension of a GEOM_3D value, always 3. | NULL | [ST_CoordDim(ST_Geom3DFromWKB('POINT Z (1 2 3)'::GEOMETRY))] |
| st_force3d | scalar | Returns a GEOM_3D value with XYZ coordinates; GEOM_3D already stores XYZ, so this is an identity. | NULL | [ST_Force3D(ST_Geom3DFromWKB('POINT Z (1 2 3)'::GEOMETRY))] |
| st_geom3dfromwkb | scalar | Builds a GEOM_3D from WKB or GEOMETRY: Point, LineString, Polygon, their Multi forms, or PolyhedralSurface, all with Z; a TIN or Triangle is read as the PolyhedralSurface or Polygon it is. Raises on anything else, GeometryCollection included. | NULL | [ST_Geom3DFromWKB('POINT Z (1 2 3)'::GEOMETRY)] |
| st_isplanar | scalar | Returns whether each ring of a GEOM_3D surface is planar within tolerance; for points and lines, whether all vertices are coplanar. | NULL | [ST_IsPlanar(ST_Geom3DFromWKB('POLYGON Z ((0 0 0, 2 0 0, 2 2 0, 0 2 0, 0 0 0))'::GEOMETRY))] |
| st_makesolid | scalar | Promotes a closed PolyhedralSurface GEOM_3D to a SOLID_3D. Raises unless the surface is already closed, manifold and oriented; nothing is repaired. | NULL | [ST_MakeSolid(ST_Geom3DFromWKB(ST_3DAsWKB(ST_3DExtrude(ST_Geom3DFromWKB('POLYGON Z ((0 0 0, 2 0 0, 2 2 0, 0 2 0, 0 0 0))'::GEOMETRY), 3.0))))] |
| st_ndims | scalar | Returns the coordinate dimension of a SOLID_3D or GEOM_3D value, always 3. A constant for PostGIS compatibility; the payload is not read. | NULL | [ST_NDims(ST_Geom3DFromWKB('POINT Z (1 2 3)'::GEOMETRY))] |
Overloaded Functions
This extension does not add any function overloads.
Added Types
| type_name | type_size | logical_type | type_category | internal |
|---|---|---|---|---|
| GEOM_3D | 16 | BLOB | NULL | true |
| SOLID_3D | 16 | BLOB | NULL | true |
Added Settings
| name | description | input_type | scope | aliases | typed_value |
|---|---|---|---|---|---|
| temp_directory | Set the directory to which temporary files are written. | VARCHAR | GLOBAL | [] | post.db.tmp |