mbtiles

The mbtiles plugin provides the ability to load maps from tiles (Tiles [5]) in a SQLite database or tile servers such as OpenStreetMaps [4]. Map tiles are used, e.g., by the high-resolution maps provided by gempa. The plugin is shipped with the gempa package mapprojections.

../_images/scmv_mbtiles.png

High-resolution map by gempa.

Note

Different maps can be loaded depending on geografic location and zoom level with the plugin tscombine which also ships with the mapprojections package.

Setup

  1. Install the SQLite Qt database driver.

  2. Add the mbtiles plugins to global configuration (global.cfg)

    plugins = ${plugins}, mbtiles
    
  3. Configure the map source, type and format:

    • for files in a SQLite database files:

      map.location = /home/data/maps/high-resolution-gempa-maps.mbtiles
      map.type = mbtiles
      
    • for map tiles from a tile server (Tile servers [4]). You may add a tile cache for storing and accessing downloaded tiles on disc:

      map.type = osm
      map.location = http://[server]]/%l/%c/%r.png
      map.osm.maxLevel = 10
      
      map.osm.cacheDir = /home/data/maps/OSM
      map.osm.cacheDuration = -1
      

Module Configuration

map.type

Values: mbtiles,osm

Type: string

The store implementation.

map.osm.tileSize

Default: 256

Unit: px

Type: int

Edge length of the square tiles received from the server.

map.osm.maxLevel

Default: 10

Type: int

Maximum available/allowed tile level. The OpenStreetMap servers typically serve data up to level 19.

map.osm.cacheDir

Type: string

Path of an optional cache directory. If specified downloaded tiles will we cached to speed up requests and to save network bandwidth.

map.osm.cacheDuration

Default: 86400

Unit: s

Type: int

Number of seconds a cached tile is valid. Cache files older than the specified number of seconds are reloaded from the tile server upon request. Use a negative value to indicated an unlimited cache duration.