I've a high quantity of H3 hexagons that I would like to make them easily identifiable on a map by assigning sequential numbers starting from 0 based on their location. I'm using the field calculator on Qgis. I tried to number a new field according to the Y coordinate, but since it is inclinated the number start to jump, with some really annoying gaps.

The error: enter image description here Dataset H3 index: 881ea438e9fffff 881ea438ebfffff 881ea438edfffff 881ea438e1fffff 881ea438e3fffff 881ea43831fffff 881ea43833fffff 881ea43887fffff 881ea438e5fffff 881ea438e7fffff 881ea43835fffff

What I would like to have: enter image description here

Do you have any suggestion to solve this issue?

  • 1
    What is your expected numbering? The screenshot is showing it? Or what is wrong with the screenshot numbering? What is the rotation of your grid, about 10 degrees?
    – Bera
    Commented Sep 22, 2023 at 5:09
  • My expected numbering is a sequence increasing number from north to south, from west to east as this one in the picture below. The one in the upper picture present many jump of no sequencial number if we see near hexagon. the inclination can variate quite a lot depending on the area, unluckly. Commented Sep 22, 2023 at 7:56
  • Can you throw a sample data set at us? If you know the approximate angle the data are rotated relative to grid N, then it should be possible to rotate the centroids and then number by rotated x-y coordinate. Problem is the rotation angle will depend on the location and H3 grid depth, but this might be inferrable from the data... Or have you got the H3 index values? That might order in this way..
    – Spacedman
    Commented Sep 22, 2023 at 8:21
  • just added the first 10 h3 index of the "wrong" sequential numbering. I already tried to rotate the Y coordinate with trigonometry, for some situations worked well, for other not. Commented Sep 22, 2023 at 8:53
  • 1
    Do your H3 polygons have the ijk or some local ij coordinates? h3geo.org/docs/core-library/coordsystems
    – Spacedman
    Commented Sep 22, 2023 at 9:10


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.