-
Notifications
You must be signed in to change notification settings - Fork 651
CDB_HexagonGrid
andrewxhill edited this page Feb 8, 2013
·
7 revisions
Fill given extent with an hexagonal coverage
Create a hexagonal grid from a polygon geometry. For example, take the geometry
ST_SetSRID(
ST_Envelope(
ST_Collect(
ST_MakePoint(10000000,-10000000),
ST_MakePoint(-10000000,10000000)
)
),
3857)
We can create a grid as follows,
SELECT CDB_HexagonGrid(
ST_SetSRID(
ST_Envelope(
ST_Collect(
ST_MakePoint(10000000,-10000000),
ST_MakePoint(-10000000,10000000)
)
),
3857),
1000000) the_geom_webmercator
Which will look something like this,
CDB_HexagonGrid(ext, side, origin)
- ext geometry. Extent to fill. Only hexagons with center point falling inside the extent (or at the lower or leftmost edge) will be emitted. The returned hexagons will have the same SRID as this extent.
- side float. Side measure for the hexagon. Maximum diameter will be 2 * side.
- origin OPTIONAL geometry. Optional origin to allow for exact tiling. If omitted the origin will be 0,0. The parameter is checked for having the same SRID as the extent.