How can I create a spatial binning similar to or directly using Uber h3 from QGIS UI?
Are there plugins available to achieve the desired task?
How can I create a spatial binning similar to or directly using Uber h3 from QGIS UI?
Are there plugins available to achieve the desired task?
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.
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
Commented
Mar 2, 2021 at 22:40
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:
There is an error message of "it seems there is no valid script to run", but it works anyway.
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.)