PostGIS

ST_3DDifference

Prev

7.21. SFCGAL Functions

Next

Name

ST_3DDifference — Perform 3D difference

Synopsis

geometry +`*`+ST_3DDifference*(`geometry `geom1, geometry geom2`)`;

Description

Returns that part of geom1 that is not part of geom2.

Availability: 2.2.0

check This method needs SFCGAL backend.

check This method implements the SQL/MM specification.

SQL-MM IEC 13249-3: 5.1

check This function supports 3d and will not drop the z-index.

check This function supports Polyhedral surfaces.

check This function supports Triangles and Triangulated Irregular Network Surfaces (TIN).

Examples

3D images were generated using PostGIS ST_AsX3D and rendering in HTML using X3Dom HTML Javascript rendering library.

SELECT ST_Extrude(ST_Buffer(ST_GeomFromText('POINT(100 90)'),
 50, 'quad_segs=2'),0,0,30) AS geom1,
        ST_Extrude(ST_Buffer(ST_GeomFromText('POINT(80 80)'),
 50, 'quad_segs=1'),0,0,30) AS geom2;

st_3ddifference01

Original 3D geometries overlaid. geom2 is the part that will be removed.

SELECT ST_3DDifference(geom1,geom2)
FROM ( SELECT ST_Extrude(ST_Buffer(ST_GeomFromText('POINT(100 90)'),
 50, 'quad_segs=2'),0,0,30) AS geom1,
        ST_Extrude(ST_Buffer(ST_GeomFromText('POINT(80 80)'),
 50, 'quad_segs=1'),0,0,30) AS geom2 ) As t;

st_3ddifference02

What’s left after removing geom2

See Also

Prev

Up

Next

ST_3DIntersection

Home

ST_3DUnion