1.11 Vector Tiles

Oracle Spatial provides support for generating vector tiles from spatial data in database tables. The vector tile format is designed for highly efficient streaming of spatial data to map visualization clients.

Vector tiles contain geometry and attribute data in a compressed binary format covering square areas defined by a tiling scheme. In a tiling scheme, the world is divided into square tiles identified by X and Y ordinates at each of a predefined set of zoom levels. Modern mapping clients are designed to consume spatial data from vector tiles and style information from style sheets. This affords tremendous flexibility and agility by allowing a single vector tile dataset to be leveraged for numerous map styles.

Oracle Spatial supports the generation of vector tiles from spatial data in tables with the SDO_UTIL.GET_VECTORTILE function. Vector tiles may be generated based on either the Google or TMS tiling scheme.

Also, vector tile caching is supported.

1.11.1 Vector Tile Cache

Oracle Spatial supports caching of vector tiles which significantly improves the performance when working with vector tiles.

When a tile is requested through SDO_UTIL.GET_VECTORTILE, the procedure first checks for the tile in the cache. If the tile exists, then the cached version of the tile is returned (without comuputing the tile again). If the tile is not found in the cache, then the tile is computed and returned. The computed tile is also placed in the cache for later use. However, note that vector tile caching is supported only when you call SDO_UTIL.GET_VECTORTILE by providing the table and geometry column name. If you provide a cursor input when requesting a vector tile, then the tile is not cached.

A tile cache is defined as a set of vector tiles that share a table_name/geom_col_name pair. For example table_a/geom_col and table_b/geom_col are two different tile caches. Each of these caches are maintained in the following two tables:

  • SDO_VECTOR_TILE_CACHE$INFO: This table contains one row of the cache metadata.
  • SDO_VECTOR_TILE_CACHE$TABLE: This table contains many rows, each of which is an individual vector tile.

For more information on managing vector tile caches, refer to the following procedures:

DML and DDL Operations on Vector Tile Cache Source Table

In order to ensure that the cache remains consistent during DML and DDL operations, triggers are placed appropriately on the database table that provides the source data for the vector tiles in the cache. If a DML operation is performed on the source table, then those tiles in the cache that contain data generated from the modified, inserted, or deleted rows are removed from the cache. The next time SDO_UTIL.GET_VECTORTILE is called, these tiles are rebuilt using the new data, and are stored back in the cache.

It is strongly recommended that the vector tile caches are disabled before any large scale DML operations. It is because each DML operation performs a spatial operation to check if the row being modified interacts with any of the tiles in the cache. This has the potential to slow the DML operation substantially. Therefore, disabling the cache before the DML operations removes this slow down. You can reenable the cache after the DML operations are completed. In case of small DML operations, you may leave the cache enabled. Although the DML operations may be comparatively slower, it is still preferable than having to rebuild the cache.

However, if a DDL operation needs to be done on the source table, then all vector tile caches based on that table must be disabled. The only exception to this rule is TRUNCATE TABLE which may be run with a tile cache enabled.