Nome

ST_Hexagon — Returns a single hexagon, using the provided edge size and cell coordinate within the hexagon grid space.

Sinopse

geometry ST_Hexagon(float8 size, integer cell_i, integer cell_j, geometry origin);

Descrição

Uses the same hexagon tiling concept as ST_HexagonGrid, but generates just one hexagon at the desired cell coordinate. Optionally, can adjust origin coordinate of the tiling, the default origin is at 0,0.

Hexagons are generated with no SRID set, so use ST_SetSRID to set the SRID to the one you expect.

Disponibilidade: 2.1.0

Exemplos

Creating a hexagon at the origin.

Code
SELECT ST_SetSRID(ST_Hexagon(1.0, 0, 0), 3857);
Raster Outputs
POLYGON((-1 0,-0.5 -0.8660254037844387,0.5 -0.8660254037844387,1 0,0.5 0.8660254037844387,-0.5 0.8660254037844387,-1 0))
Figure
Geometry figure for visual-st-hexagon-01