Expands a pcpatch into a set of pcpoint rows, returning one row per point in the patch.
Syntax
setof[pcpoint] ST_explode(pcpatch pc)Parameters
| Parameter | Type | Description |
|---|---|---|
pc | pcpatch | The patch to expand. |
Example
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]} | 7ST_Explode is a set-returning function. Each call returns one pcpoint row per point in the patch. The query wraps ST_Explode in ST_AsText to render each point as a JSON string. Ten rows are returned because patch 7 contains ten points.
该文章对您有帮助吗?