ST_intersection

更新时间:
复制 MD 格式

Returns a new pcpatch object containing only the points from a pcpatch that fall within the given geometry.

Syntax

pcpatch ST_Intersection(pcpatch pc, geometry geom);

Parameters

ParameterDescription
pcThe pcpatch object.
geomThe geometry object. Must be a valid Ganos Geometry type.

Example

The following query clips a point cloud patch to a triangular polygon and returns the individual points within the intersection.

SELECT ST_AsText(ST_Explode(ST_Intersection(
      pa,
      'SRID=4326;POLYGON((-126.451 45.552, -126.42 47.55, -126.40 45.552, -126.451 45.552))'::geometry
)))
FROM patches WHERE id = 7;

Output:

             st_astext
--------------------------------------
 {"pcid":1,"pt":[-126.44,45.56,56,5]}
 {"pcid":1,"pt":[-126.43,45.57,57,5]}
 {"pcid":1,"pt":[-126.42,45.58,58,5]}
 {"pcid":1,"pt":[-126.41,45.59,59,5]}