Maps a 2D geometry object onto the surface of a 3D meshgeom object, returning a 3D geometry object.
Syntax
geometry ST_GeometryMatch(meshgeom geom3d, geometry geom2d, cstring direction, float8 sample);Parameters
| Parameter | Type | Description |
|---|---|---|
geom3d | meshgeom | The 3D meshgeom object that serves as the target surface. |
geom2d | geometry | The 2D geometry to project onto the mesh. Supported types: Point, MultiPoint, LineString, MultiLineString. |
direction | cstring | The matching direction. Valid values: TOP and BOTTOM. |
sample | float8 | The sampling interval for the 2D geometry object. |
Description
ST_GeometryMatch absorbs or maps a 2D point or line geometry onto the surface of a 3D meshgeom object. The following adsorption or matching directions are supported: top adsorption or matching and bottom adsorption or matching.
The sample parameter controls the spacing between inserted intermediate points along line geometries before projection.
Effect diagram
A 2D line is matched to a 3D meshgeom object along the TOP direction to generate a 3D line. 
Examples
Map a LineString onto a mesh from below (BOTTOM)
SELECT ST_AsText(
ST_GeometryMatch(
'MESHGEOM(PATCH(TRIANGLESTRIP Z(0 0 0,10 0 0,0 10 0,0 0 10)))'::mesh,
'LINESTRING(1 1, 1.1 1.1)',
'BOTTOM',
0.02
)
);Expected output:
LINESTRING Z (1 1 0,1.01414213562373 1.01414213562373 0,1.02828427124746 1.02828427124746 0,1.04242640687119 1.04242640687119 0,1.05656854249492 1.05656854249492 0,1.07071067811866 1.07071067811866 0,1.08485281374239 1.08485281374239 0,1.09899494936612 1.09899494936612 0,1.1 1.1 0)The output is a LINESTRING Z where each vertex carries a Z coordinate. The sampling interval of 0.02 controls the spacing between inserted vertices along the input line.