H3 Spatial Indexing, accelerated with Snowflake & CARTO

TL;DR
H3 is a hexagonal discrete global grid that divides the world into cells at multiple resolutions and identifies each cell by a short reference ID rather than a long list of vertex coordinates, which makes it much smaller to store and faster to query than the equivalent geometries. In February 2024 Snowflake shipped native support for it, built in collaboration with CARTO, as 19 H3-specific SQL functions covering grid creation, moving between resolutions, and converting cells back to geometry. CARTO’s Analytics Toolbox for Snowflake layered more on top: K-ring and Hex-ring for areas of influence without generating buffers or isolines, compact multi-resolution grids, enrichment from the Data Observatory, and Getis-Ord* and Local Moran’s I for cluster and outlier detection. The function count and the training programme described below date from early 2024; check CARTO’s Snowflake documentation and Snowflake’s own spatial function reference for what is available now.

We’re excited to announce that H3 is now available natively in Snowflake! CARTO are industry leaders in pushing the boundaries of working with big spatial data, and we are so thrilled to have brought our geospatial expertise to this collaboration with Snowflake to make this game-changing technology a reality! We know this will mean big things for Snowflake users in terms of unlocking a new scale of geospatial analysis and visualization.

‍

Leveraging H3 with CARTO and Snowflake opens up a world of possibilities for businesses and data professionals seeking to supercharge their geospatial data analytics. 

But hold on… What is H3? What does it mean for you? And how can you get started? Keep reading to find out all of this, as well as information about our new H3 Acceleration Programme!

What is H3?

H3 is a type of Discrete Geographical Grid (DGG) or Spatial Index. This approach indexes the world into a grid at multiple resolutions.

The relationships between different resolutions of H3.

What makes Spatial Indexes like H3 really special is how locations are indexed. Traditionally, spatial data is geolocated through a geometry; a long (and we mean LONG) reference string consisting of all vertex coordinate pairs. Spatial Indexes just use a short reference ID to do this, making them far smaller to analyze and lightning-fast to process.

Geometries vs Spatial Indexes
Geometries vs Spatial Indexes.

H3 in particular owes a lot of its popularity to its hexagonal shape which is optimal for representing spatial data, with its lack of acute angles and consistent relationships with its neighbors - learn more about this here!

Ready to get started?

H3 Native Support in Snowflake with CARTO

‍

This map leverages H3 for the creation of a Wildfire Risk Index for California. Land cover type, temperature and wind speeds are all incorporated into one single score to help insurers understand the risk of wildfire.

We're proud to have collaborated with Snowlake to offer you native support for H3 within Snowflake, allowing you to leverage the power of H3 without any hassle. This support includes 19 H3-specific SQL functions to help users scale their spatial analysis. These functions allow users to:

  • Create H3 grids with functions like polyfill, point and lat-long to cell.
  • Seamlessly move between H3 resolutions with parent and children functions.
  • Easily translate data between H3 and geometry types with functions such as cell to boundary.

By harnessing the power of CARTO with Snowflake, you can build on these functions with more advanced features of our Analytics Toolbox. For instance:

  • Our dedicated H3 module allows you to go even further with manipulating H3 data, with functions such as K-ring and Hex-ring - both of which allow you to generate areas of influence around a central H3 cell. This approach is far more efficient than the alternatives of generating buffer or isoline geometries! Other functions allow you to generate multi-resolution compact grids, and H3 distance with which you can calculate the grid distance between two cells. 
The concept of H3 K-rings
The concept of H3 K-rings.
  • The Data module allows users to easily enrich H3 grids with their own data - or data they’ve subscribed to from our Data Observatory!
  • Finally, turn your data into insights with our Statistics module! Use Getis Ord* to identify statistically significant spatial clusters in your H3 grid, or Local Moran’s I to establish outliers within these patterns. Find out more about how to use these spatial clustering techniques here. 

Learn more about all of these functions in our documentation here. 

One of the great advantages of leveraging H3 in Snowflake with CARTO is that you can build advanced analytical pipelines with our low-code tool CARTO Workflows, which offers pre-built components that leverage the H3 functions available in the Analytics Toolbox. Check out our collection of Workflow templates to get you started!.

‍

Example of workflow leveraging the H3 K-ring property to define areas of influence.
Example of workflow leveraging the H3 K-ring property to define areas of influence. Available as a template here.

With our mapping platform CARTO Builder you can visualize H3 natively, allowing you to quickly visualize millions of features! You can also take advantage of some of our Spatial Index-specific data visualization features, such as the ability to change the resolution that H3 cells are rendered at. This rendering of massive spatial data is made even more seamless through our dynamic tiling functionality.

Maps in CARTO showing the difference between visualizing data via points vs H3.

‍

Looking to boost your geospatial analysis with H3? Join our webinar with Snowflake on March 13th!

If you’re struggling to visualize large datasets without compromizing performance, join our upcoming webinar on March 13th (12PM ET) with Snowflake. Sign up here!

Join Our H3 Training Program Today!

Ready to start your H3 journey? Introducing the H3 Acceleration Programme!

Embark on a transformative journey with the power of the H3 Spatial Index. Tailored to the unique needs of your organization, our program will catalyze your spatial analytics capabilities with modules including Advanced analytics with H3 in your Data Warehouse  and Applying H3 in your data models and workflows.

Whether you're new to H3 or looking to enhance your skills, our program can help you become proficient in using H3, and accelerate adoption across your organization for maximum business impact. Sign up here to register your interest and receive more details.

—

Ready to get started? Take your first steps towards becoming an H3 pro and sign up for a free 30-day CARTO trial today!

Frequently Asked Questions

What is the H3 spatial index?

H3 is a discrete global grid, also called a spatial index, that divides the Earth into hexagonal cells at a series of nested resolutions, so a coarse cell can be broken down into finer children. Its distinguishing feature is how locations are referenced: instead of storing a geometry as a long string of vertex coordinate pairs, each cell has a short ID. Hexagons are favored for spatial work because they have no acute angles and each cell sits at a consistent distance from all its neighbors.

Why is a spatial index faster than storing geometries?

Because of what is stored per record. A polygon geometry carries every vertex coordinate pair, which for real-world boundaries can be a very long value; an H3 cell carries a single short identifier. Smaller records mean less data to scan, and joins between datasets become a match on identical cell IDs rather than a computed spatial intersection, which is far cheaper. That is what makes it practical to visualize millions of cells on a map.

What H3 functions did Snowflake add natively?

Snowflake’s native H3 support, announced in February 2024 and developed in collaboration with CARTO, introduced 19 H3-specific SQL functions in three groups: creating grids, with polyfill and functions converting a point or a latitude-longitude pair to a cell; traversing resolutions, with parent and children functions; and translating between H3 and geometry, with functions such as cell to boundary. Snowflake’s spatial function reference carries the current list, which has changed since 2024.

What can CARTO's Analytics Toolbox do with H3 beyond Snowflake's native functions?

As of February 2024, three modules extended it. The H3 module added K-ring and Hex-ring, which generate areas of influence around a central cell far more cheaply than building buffer or isoline geometries, plus compact multi-resolution grids and grid distance between two cells. The Data module enriched H3 grids with a user’s own data or with Data Observatory subscriptions. The Statistics module added Getis-Ord* for finding statistically significant spatial clusters and Local Moran’s I for identifying outliers within them. CARTO Workflows exposed these as pre-built low-code components, and CARTO Builder rendered H3 natively, including changing the resolution cells are drawn at.

What is an example of H3 used for a real analysis?

The post shows a wildfire risk index for California built on H3. Land cover type, temperature and wind speed are each aggregated to the same H3 grid and combined into a single score per cell, which gives insurers a consistent way to compare wildfire risk between areas. Using a shared grid is what makes the combination straightforward: the three inputs arrive in different native formats and resolutions, but once each is expressed per H3 cell they join on the cell ID.

Hear from our experts!

Request a Demo