Spatial Indexes

The CARTO platform natively supports spatial indexes, enabling you to leverage their capabilities when working with large-scale data directly in your data warehouse. Spatial indexes are excellent for large-scale analytics and visualization. Using Builder, you can create stunning and powerful visualizations by connecting directly to these types of sources. The supported spatial index formats are quadbins and H3.

Based on Discrete Global Grid (DGG) systems, spatial indexes reference each cell of the grid. Think of a spatial index as an id that always makes reference to the same portion of the surface on Earth.

  • This portion of the Earth is called a cell.

  • The shape of the cell depends on the type of index. For example, H3 uses hexagons; while Quadbin uses square.

  • The size of the cell depends on the resolution. The higher the resolution, the smaller the size of the cell.

DGG systems are hierarchical, which means that every cell contains a constant number of smaller cells at a higher resolution:

Example of how each H3 cell is sub-divided into smaller cells at higher resolutions.

Advantages of working with spatial indexes

One of the advantages of working with spatial indexes is that operating with them in data warehouses is way more efficient and cost-effective than computing geometries. They are also smaller in size and help saving storage and reducing the volume of transferred data.

When working with spatial indexes, Builder will dynamically aggregate your data into cells at a meaningful resolution depending on the current map zoom level. See the animation below for an example:

Visualizing spatial index sources

Your spatial index source must contain a column storing the spatial index identifier. Below is an example table containing h3 indexes, with some additional columns that contain aggregated socio-demographic data for each hexagon:

h3populationavg_rent

8a0c0036a49ffff

103.0

1344.56

8a0c002e4c0ffff

1093.0

2087.04

8a0c002e4caffff

209.0

3098.39

The h3 column contains the indexes for H3 cells at level 10. That’s what we call the native resolution of the data.

When you load a source in Builder, data is aggregated dynamically as you zoom in an out. This aggregation will be generated on the fly, using SQL queries that are pushed from CARTO into the data warehouse.

When visualizing a spatial index source in Builder, you can control the aggregation size, to define how granular you'd like the aggregation to be when navigating through the map as part of the layer styling configuration. Learn more in this section.

To understand more about performance and processing cost optimizations that should be applied to this specific source type, check this section.

Last updated