ST_S2ToGeom¶
Introduction: Returns an array of Polygons for the corresponding S2 cell IDs.
Hint
To convert a Polygon array to MultiPolygon, use ST_Collect. However, the result may be an invalid geometry. Apply ST_MakeValid to the ST_Collect output to ensure a valid MultiPolygon.
An alternative approach to consolidate a Polygon array into a Polygon/MultiPolygon, use the ST_Union function.
Format: ST_S2ToGeom(cellIds: Array[Long])
Since: v1.6.0
SQL Example:
SELECT ST_S2ToGeom(array(11540474045136890))
Output:
[POLYGON ((-36.609392788630245 -38.169532607255846, -36.609392706252954 -38.169532607255846, -36.609392706252954 -38.169532507473015, -36.609392788630245 -38.169532507473015, -36.609392788630245 -38.169532607255846))]