Skip to content

3. Generate Grid

The Generate Grid panel builds the hex layers used by the rest of the workflow. It uses the AOI selected here and the Hex scale (m) from Setup.

Panel layout

The panel has these controls:

  • Refresh Layers
  • a. Set AOI
  • Select Layers (collapsed by default)
  • Build Hex Grid

a. Set AOI

Choose the AOI you want to turn into a hex grid from the AOI dropdown.

If no AOI appears, click Refresh Layers first.

Select Layers

Expand Select Layers to choose which outputs to create.

Layer What it is Notes
Hex Tiles Polygon hex grid clipped to the AOI Usually required.
Hex Grid Edges Line version of the hex boundaries Useful as an overlay.
Intersection Helpers Point layer at hex vertices Useful for snapping.
Centroid Helpers Point layer at hex centers Useful for labels and point-based analysis.

All four are checked by default.

Check/Uncheck All

Use Check/Uncheck All to flip all layer checkboxes at once.

Using an existing Hex Tiles layer

If Hex Tiles is unchecked and one or more helper layers are still checked, the plugin requires an existing polygon hex layer in Source Hex Tiles.

Use this when you already have hex tiles and only want to regenerate helpers.

What Build Hex Grid does

When you click Build Hex Grid, the plugin:

  1. Reads the selected AOI.
  2. Creates a hex grid using the current hex scale.
  3. Clips the grid to the AOI polygon if Hex Tiles is enabled.
  4. Adds tile indexing fields to the tile layer.
  5. Creates helper layers from the tile layer if requested.
  6. Saves shapefiles under Layers/Base/Base_Grid/<AOI>/.
  7. Builds .qix spatial indexes where possible.
  8. Loads the saved layers into Base > Base Grid > <AOI>.

This is a direct processing workflow. The current code does not run it as a background task.

Output files

The grid outputs are saved with these filenames:

Layers/Base/Base_Grid/<AOI>/
  hex_tiles_<hex_scale>m.shp
  hex_edges.shp
  hex_vertices.shp
  hex_centroids.shp

Only the files for the layers you selected are created.

Loaded layer names

When loaded back into QGIS, the layer names are:

  • Hex Grid Tiles - AOI <n> - <width> x <height> - <hex_scale>m
  • Hex Grid Edges
  • Intersection Helpers
  • Centroid Helpers

Tile indexing fields

The generated Hex Tiles layer gets these attributes:

Field Meaning
col_index Column number, starting from west to east
row_index Two-digit row label within the current 99-row block
row_extra Extra row block count once a column exceeds 99 rows
id Combined tile id built from column and row labels

If Centroid Helpers are generated, the centroid layer also receives the same tile index fields by matching each centroid to its parent polygon.

Styling

The plugin tries to apply these QML styles first:

  • hex_tiles.qml
  • hex_edges.qml
  • hex_vertices.qml
  • hex_centroids.qml

If a QML file is missing, the code falls back to built-in programmatic styling.

Notes

  • You must have a valid project/output directory before running this step.
  • If you generate only helper layers, Source Hex Tiles must be a polygon layer.
  • The output group is nested under the AOI name, not directly under Base > Base Grid.

Next: Elevation