This topic describes the ST_GeometryMatch function. This function maps a 2D geometry object to a 3D model to generate a 3D geometry object.


geometry ST_GeometryMatch(meshgeom geom3d, geometry geom2d, cstring direction, float8 sample );


geom3dThe meshgeom object.
geom2dThe geometry object, which can be of the Point, MultiPoint, LineString, and MultiLineString type.
directionThe matching direction. Valid values: TOP and BOTTOM.
sampleThe sampling interval for the 2D geometry object.


  • This function absorbs or maps a 2D geometry object to the surface of a 3D meshgeom object.
  • The 2D geometry object can be a point or line.
  • The following adsorption or matching directions are supported: top adsorption or matching and bottom adsorption or matching.

Effect diagram

A 2D line is matched to a 3D meshgeom object along the TOP direction to generate a 3D line. Effect diagram


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));
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)