How can I create a spatial binning similar to or directly using Uber from QGIS UI?

Are there plugins available to achieve the desired task?

  • 4
    If you explain how Uber H3 does spatial binning, you're more likely to get a useful answer. Otherwise the only people who can answer would be those who know both Uber H3 and QGIS, which may be a very small number of people.
    – csk
    Commented Feb 1, 2019 at 17:36
  • It looks like eng.uber.com/h3 and mostly consists of hexagons. A solution in python would also be great. Commented Feb 1, 2019 at 18:42

4 Answers 4


You can play with it using my #30DayMapChallenge hexagon demo https://github.com/ThomasG77/30DayMapChallenge/blob/master/day4_hexagons/data/h3-processing.py

Except the fact I do no use an UI, I combine both QGIS and Uber H3 Python library.

I clearly do not use all parts of the H3 Python library. I suppose the example could help you getting started.

Edit 2022-05-20

New QGIS plugin "H3 Toolkit" unrelated to me but doing more or less the same. Although we provide the link, install it directly from QGIS plugins list.

  • Thanks Thomas. You're implementation was very helpful. I adapted it to generate hex grids for the extent of an input layer: github.com/maphew/code/blob/master/gis/qgis/… Commented Feb 3, 2021 at 7:00
  • Thanks mat wilkie. I cant run the script.I get the error: File "<string>", line 55, in <module> IndexError: list index out of range
    – Torsten
    Commented Mar 2, 2021 at 20:03
  • At github.com/maphew/code/blob/master/gis/qgis/…, the code is mylayer = QgsProject.instance().mapLayersByName(area_of_interest)[0]. It means QgsProject.instance().mapLayersByName(area_of_interest) is an empty list [] and you can't get the first element with [0]. That's why it throws an error
    – ThomasG77
    Commented Mar 2, 2021 at 22:40
  • Thanks Thomas. That bug is now fixed, and a couple more besides. Results posted at gis.stackexchange.com/a/408312/108 Commented Aug 14, 2021 at 5:58

I adapted @ThomasG77's 30 day challenge script into something that can be run from the Qgis processing toolbox.

Using Uber's H3 hex grid system in Qgis

https://github.com/maphew/code/tree/master/gis/qgis - h3-grid-from-layer.py


after Preparation has been completed

From Qgis:

  1. Select a template layer in table of contents to get extent from
    1. Optionally select specific features
  2. Processing tool box >> Open existing script: h3-grid-from-layer.py
  3. OR: Plugins >> Python console >> Open editor >> load script: h3-grid-from-layer.py
  4. Edit variables (particularly min/max resolution levels)
  5. Run

There is an error message of "it seems there is no valid script to run", but it works anyway.

screenshot: select extents layer, open script screenshot: edit min/max hexes screenshot: result


There's the official https://github.com/uber/h3-py

Python bindings for H3, a hierarchical hexagonal geospatial indexing system https://uber.github.io/h3/

but I haven't tried it myself.


Use the Create Grid tool in QGIS, and select hexagons.

For a more thorough, but still brief walk-through, see Jonathan Soma's blog.

(This is for creating a hex grid, it will not be specific to Uber's H3 grids. If you know the positioning and spacing of that grid you could use those numbers with this tool.)

Your Answer

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

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