#polars #spatial #geospatial #h3 #bounding-box


Integration of the h3 geospatial indexing system with polars dataframes

4 releases (breaking)

0.4.0 Dec 16, 2023
0.3.0 Jan 19, 2023
0.2.0 Oct 28, 2022
0.1.0 Oct 25, 2022

#16 in #h3

25 downloads per month

MIT license

5.5K SLoC


Latest Version Documentation

Integration of the h3 geospatial indexing system with polars dataframes by providing extension traits to UInt64Chunked and DataFrame.

This integration does not aim to be feature-complete, it was created by moving functionalities implemented in other projects to this common crate for better usability. In case of missing features, please submit a PR.

Some features so far:

  • Convert from UInt64Chunked to H3 cells and edges and vice versa.
  • Algorithms on UInt64Chunked for building grid-disks, changing the cell resolution, deriving the bounding box and some more.
  • Spatial-indexing of H3-cells and edges using the kdbush spatial index. The spatial index returns a BooleanChunked array suitable to be used with polars filters.
  • Algorithms on DataFrame for compacting/uncompacting the contained data by grouping the rows based on the remaining columns and applying compaction/uncompaction to the cell column.

Maintenance status

In january 2023 the h3o library - a port of H3 to rust - has been released. This brings many benefits including type safety, compilation to WASM and performance improvements (example: issue comparing raster to h3 conversion).

As a result this library will most certainly only receive dependency upgrades in the future.


~757K SLoC