I've been looking at creating an indexed grid and have used vector--grid, mmqgis--create grid and FSC Tools.

They all work fine but don't label the grid squares. With the one created by vector grid, there is left/bottom/right and top so if we sort by top then the highest value is the top left grid square -which I want called A1.

The next in the list is A2 and then when the top value changes it's row B etc.

Is there some switch or other tool that can add these labels?

I noticed there's a QGIS 2x plugin (https://plugins.qgis.org/plugins/createnamedgrid/) but I haven't found one for v3.

I have tried the process in Creating indexed vector grid in QGIS? but it doesn't work as expected.

enter image description here

I wonder if this has something to do with the row ID's being assigned based on the order the table was written in...it should be Top (highest to lowest) and Right (lowest to highest) to get the grid in the right order to test this. I have tried the sort and number plugin and changed 15 in the solution to 36 to represent the number of squares left to right but it still doesn't work.


With the QGIS grid tool, you can create a grid with "top", "bottom", "left", "right" fields (same as mmQGIS plugin) with respective grid feature coordinates.

The maximum grid size with this code is :

  • rows : 26 (A to Z) + 26 * 26 (AA to ZZ) = 702
  • columns : unlimited

With the following label formula, you can achieve what you want :

Here, the 999 value is the size of my grid in layer units (width or height of the grid cell, I precise it in the code each time if you have rectangular grid cells for example).

  WHEN floor(((maximum("top") - "top" ) / 999) / 26) > 0 --height
  THEN char(floor(((maximum("top") - "top" ) / 999) / 25) + 64) --height
  ELSE ''
char(((maximum("top") - "top") / 999) % 26 + 65) --height
to_string(("right" - minimum("left")) / 999) --width

Results :

A1, A2, ...
B1, B2, ...
AA1, AA2, ...
AB1, AB2, ...
  • Inverted solution :

    • rows : unlimited
    • columns : 26 (A to Z) + 26 * 26 (AA to ZZ) = 702
-- first column letter for after the column "Z"
  WHEN floor((("right" - minimum("right")) / 999) / 26) > 0 --width
  THEN char(floor((("right" - minimum("right")) / 999) / 25) + 64) --width
  ELSE ''
|| -- concatenate
-- the column value converted into a letter between A - Z
char((("right" - minimum("right")) / 999) % 26 + 65) --width
|| -- concatenate
-- the row value converted in string
to_string((maximum("top") - "bottom") / 999) --height

Results :

A1, B1, ..., AA1, AB1, ...
A2, B2, ..., AA2, AB2, ...
  • Great thanks. If anyone is using it -"layer units" is just the width/height of the a single grid in whatever units/projection you are in.
    – GeorgeC
    Aug 1 '19 at 23:27
  • 1
    I've added some precisions about that in my answer. Aug 2 '19 at 7:55
  • I do get random [ in the letter portions when I get to a new set letters. eg. instead of going from AZ to BA, it goes from AZ to A[ to BB. other wise works great
    – B-C B.
    Nov 6 '20 at 2:15

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.