PostGIS
Name
ST_Square — Returns a single square, using the provided edge size and cell coordinate within the square grid space.
Synopsis
geometry +`*`+ST_Square
*(`float8 `size
, integer cell_i
,
integer cell_j
, geometry origin`
)`;
Description
Uses the same square tiling concept as ST_SquareGrid, but generates just one square at the desired cell coordinate. Optionally, can adjust origin coordinate of the tiling, the default origin is at 0,0.
Squares are generated with no SRID set, so use ST_SetSRID to set the SRID to the one you expect.
Availability: 3.1.0
Example: Creating a square at the origin
SELECT ST_AsText(ST_SetSRID(ST_Square(1.0, 0, 0), 3857));
POLYGON((0 0,0 1,1 1,1 0,0 0))