Analytics Toolbox for Postgres

Analytics Toolbox for Postgres

Tilesets

The tiler is a module of the Analytics Toolbox for PostgreSQL that allows to process and visualize very large spatial datasets stored in your PostgreSQL database.

How it works

The tiler procedures will process your data and create a complete tileset out of it. All the map tiles for the specified zoom range will be stored in a PostgreSQL table in MVT format. Each individual tile is a row in this table, with the tile coordinates and the corresponding geometry data stored in different columns:

Row z x y data
1 16 45340 24576 H4sIAAAAAAAA/5Py52JPdt3eyCLEwM (…)
2 16 45292 24576 H4sIAAAAAAAA/5Py52JjLM0pEZLgWL (…)

Visualizing and publishing your tilesets is straight-forward using Builder, the map making tool integrated into the CARTO Workspace.

The integration of tilesets with custom web map applications is also possible with CARTO Maps API, which will connect to PostgreSQL using your connection’s credentials to fetch and serve the tiles.

Tileset types and procedures

The tiler module enables the creation of three types of tilesets: simple, aggregation and spatial index tilesets. Simple tilesets encode all the input features as is, while aggregation tilesets encode aggregations over the input features. Therefore, you should use simple tilesets for visualizing a dataset of world rivers, but use an aggregation tileset to visualize a heatmap of the trees distribution in New York City. On the other hand, spatial index tilesets allow the creation of tilesets aggregating data from an input table that uses H3 or Quadbin spatial indexes as geographic support systems.

We provide the following set of procedures to create tilesets:

  1. carto.CREATE_SIMPLE_TILESET

    • This procedure creates a simple tileset. You should use it if you have a dataset with any geography type (point, line, or polygon) and you want to visualize it at an appropriate zoom level.
    • The geographies will be represented exactly as stored in PostgreSQL, which means that if they are too small to be visible at a certain zoom level they won’t be included in the tiles at that zoom level.
    • The values associated with each feature are the same as the ones available in the source dataset.
  2. carto.CREATE_POINT_AGGREGATION_TILESET

    • Use this procedure if you have a point dataset (or anything that can be converted to points, such as polygon centroids) and you want to see it aggregated.
    • The points will be aggregated into cells. Each feature or cell represents all the points that fall under it, so the associated properties available for visualization are generated by aggregating the values in the source dataset.dataset.
  3. carto.CREATE_SPATIAL_INDEX_TILESET

    • Use this procedure if you have a dataset based on spatial indexes, and you want to build a tileset aggregating data in the same spatial index (H3 and QUADBIN are currently supported).
    • Aggregated data will be computed for all levels between resolution_min and resolution_max.
    • For each resolution level, all tiles for the area covered by the source table are added, with data aggregated at level resolution + aggregation resolution.

Benefits

The tiler is:

  • Convenient – It can be run directly as SQL commands in PostgreSQL. The data never leaves PostgreSQL so you won’t have to worry about security and additional ETLs.
  • Fast – It benefits from the massive scalability capabilities of PostgreSQL and can process a lot of data in a few minutes.
  • Cost-effective – It allows to freely manage the resources assigned to your database according to your processing demands.