# Generates vtiles from database
genraw:
  public: true
  formats: [pbf]
  uri: tmsource://
  yaml:
    npm: ["@kartotherian/osm-bright-source", "data.yml"]
  yamlSetDataSource:
    if:
      dbname: gis
      host: ''
      type: postgis
    set:
      host: localhost
      user: {var: osmdb-user}
      password: {var: osmdb-pswd}
# expand name_ attributes into individual tags
gen:
  uri: json2tags://
  params:
    source: {ref: genraw}

# Cassandra storage
v4:
  public: true
  formats: [pbf]
  uri: cassandra://
  params:
    maxzoom: 16
    keyspace: v4
    cp: {var: cassandra-servers}
    username: {var: cassandra-user}
    password: {var: cassandra-pswd}
    repfactor: 1
    durablewrite: 0
    createIfMissing: true
    copyInfoFrom: {ref: gen}
    setLastModified: true

# set name tag based on name_* attributes
genviewraw:
  uri: babel://
  params:
    source: {ref: gen}
    tag: name
    combineName: true
    defaultLanguage: en

# View tiles as generated directly from the database. Don't view zoom0-5
genview:
  public: true
  formats: [png,json,headers,svg,jpeg]
  scales: [1.3, 1.5, 2, 2.6, 3]
  static: true
  maxheight: 2048
  maxwidth: 2048
  uri: tmstyle://
  yaml:
    npm: ["@kartotherian/osm-bright-style", "project.yml"]
  yamlSetParams:
    source: {ref: genviewraw}
  defaultHeaders:
    Cache-Control: 'no-cache, no-store, must-revalidate'
    Pragma: no-cache
    Expires: 0

# Filter out any small tiles without significant data on or after zoom 10
substgen:
  public: true
  formats: [pbf]
  uri: substantial://
  params:
    source: {ref: gen}
    minzoom: 10
    minsize: 500
    layers: [water, landuse]

# If tile has been filtered out by substgen, use overzoom to recreate it
substgenoz:
  public: true
  formats: [pbf]
  uri: overzoom://
  params:
    source: {ref: substgen}

# View tiles from generator, without the insignificant ones (will show blank squares)
substgenview:
  public: true
  formats: [png,json,headers,svg,jpeg]
  scales: [1.3, 1.5, 2, 2.6, 3]
  static: true
  maxheight: 2048
  maxwidth: 2048
  uri: tmstyle://
  yaml:
    npm: ["@kartotherian/osm-bright-style", "project.yml"]
  yamlSetParams:
    source: {ref: substgen}

# View tiles from generator, and use overzoom for any filtered out ones
substgenozview:
  public: true
  formats: [png,json,headers,svg,jpeg]
  scales: [1.3, 1.5, 2, 2.6, 3]
  static: true
  maxheight: 2048
  maxwidth: 2048
  uri: tmstyle://
  yaml:
    npm: ["@kartotherian/osm-bright-style", "project.yml"]
  yamlSetParams:
    source: {ref: substgenoz}

# Filter out any tiles stored in the v4 that are not significant
substv4:
  public: true
  formats: [pbf]
  uri: substantial://
  params:
    source: {ref: v4}
    minzoom: 10
    minsize: 500
    layers: [water, landuse]

# Use overzoom on v4 tiles for any filtered out insignificant tiles
substv4oz:
  public: true
  formats: [pbf]
  uri: overzoom://
  params:
    source: {ref: substv4}

# Show v4 tiles with insignificant ones showing as blank squares
substv4view:
  public: true
  formats: [png,json,headers,svg,jpeg]
  scales: [1.3, 1.5, 2, 2.6, 3]
  static: true
  maxheight: 2048
  maxwidth: 2048
  uri: tmstyle://
  yaml:
    npm: ["@kartotherian/osm-bright-style", "project.yml"]
  yamlSetParams:
    source: {ref: substv4}

# Show v4 tiles and use overzoom for those that have been filtered out
substv4ozview:
  public: true
  formats: [png,json,headers,svg,jpeg]
  scales: [1.3, 1.5, 2, 2.6, 3]
  static: true
  maxheight: 2048
  maxwidth: 2048
  uri: tmstyle://
  yaml:
    npm: ["@kartotherian/osm-bright-style", "project.yml"]
  yamlSetParams:
    source: {ref: substv4oz}

# Default OSM PBF source
osm-pbf:
  public: true
  formats: [pbf]
  uri: overzoom://
  params:
    source: {ref: v4}
    maxzoom: 19
  overrideInfo:
    attribution: 'Map data © <a href="http://openstreetmap.org/copyright">OpenStreetMap contributors</a>'
    tiles: ["http://localhost:6533/osm-pbf/{z}/{x}/{y}.pbf"]

babel:
  uri: babel://
  params:
    source: {ref: osm-pbf}
    tag: name
    combineName: false
    defaultLanguage: local

# OSM map with international labeling - will be used as default
osm-intl:
  public: true
  formats: [png,json,headers,svg,jpeg]
  scales: [1.3, 1.5, 2, 2.6, 3]
  maxzoom: 19
  static: true
  maxheight: 2048
  maxwidth: 2048
  uri: tmstyle://
  yaml:
    npm: ["@kartotherian/osm-bright-style", "project.yml"]
  yamlSetParams:
    source: {ref: babel}
  overrideInfo:
    attribution: 'Map data © <a href="http://openstreetmap.org/copyright">OpenStreetMap contributors</a>'
    tiles: ["http://localhost:6533/osm-intl/{z}/{x}/{y}.png"]
  defaultHeaders:
    Cache-Control: 'no-cache, no-store, must-revalidate'
    Pragma: no-cache
    Expires: 0

# OSM map without any labels
osm:
  public: true
  formats: [png,json,headers,svg,jpeg]
  scales: [1.3, 1.5, 2, 2.6, 3]
  maxzoom: 19
  static: true
  maxheight: 2048
  maxwidth: 2048
  uri: tmstyle://
  yaml:
    npm: ["@kartotherian/osm-bright-style", "project.yml"]
  yamlSetParams:
    source: {ref: osm-pbf}
  yamlExceptLayers: ['country_label', 'place_label', 'poi_label']
  overrideInfo:
    attribution: 'Map data © <a href="http://openstreetmap.org/copyright">OpenStreetMap contributors</a>'
    tiles: ["http://localhost:6533/osm/{z}/{x}/{y}.png"]
