ST_explode

Updated at:

Set-returning function that expands a pcpatch object into one pcpoint row per point.

A pcpatch stores multiple points as a single unit. Use ST_Explode when you need to access or filter individual points within a patch.

Syntax

setof[pcpoint] ST_Explode(pcpatch pc);

Parameters

ParameterDescription
pcThe pcpatch object to expand.

Examples

Expand patch ID 7 and display each point as text alongside its source row ID:

SELECT ST_AsText(ST_Explode(pa)), id FROM patches WHERE id = 7;

Output:

              st_astext               | id
--------------------------------------+----
 {"pcid":1,"pt":[-126.5,45.5,50,5]}   |  7
 {"pcid":1,"pt":[-126.49,45.51,51,5]} |  7
 {"pcid":1,"pt":[-126.48,45.52,52,5]} |  7
 {"pcid":1,"pt":[-126.47,45.53,53,5]} |  7
 {"pcid":1,"pt":[-126.46,45.54,54,5]} |  7
 {"pcid":1,"pt":[-126.45,45.55,55,5]} |  7
 {"pcid":1,"pt":[-126.44,45.56,56,5]} |  7
 {"pcid":1,"pt":[-126.43,45.57,57,5]} |  7
 {"pcid":1,"pt":[-126.42,45.58,58,5]} |  7
 {"pcid":1,"pt":[-126.41,45.59,59,5]} |  7