services:
  demo:
  wms:
    # EPSG:4326   WGS 84 -- WGS84 - World Geodetic System 1984, used in GPS
    # EPSG:5514   S-JTSK / Krovak East North -- SJTSK
    # EPSG:2065   S-JTSK (Ferro) / Krovak
    # EPSG:3857   WGS 84 / Pseudo-Mercator -- Spherical Mercator, Google Maps, OpenStreetMap, Bing, ArcGIS, ESRI
    # EPSG:900913 Google Maps Global Mercator -- Spherical Mercator (unofficial - used in open source projects / OSGEO)
    #srs: ['EPSG:4326', 'EPSG:5514', 'EPSG:2065', 'EPSG:3857', 'EPSG:900913']
    srs: ['EPSG:5514']
    bbox_srs:
      - srs: EPSG:5514
        bbox: [-1068377.92, -1407484.928, -19670.848, -883131.392]
  wmts:

layers:
  - name: CUZK_ORTO
    title: Ortofotomapa z geoportal.cuzk.cz
    sources: [cuzk_orto_cache]

caches:
  cuzk_orto_cache:
    sources: [cuzk_orto_in]
    grids: [sjtsk_grid]
  cuzk_orto_in:
    sources: [cuzk_orto]
    grids: [geoportal_cuzk_cz_wtms_grid]

sources:
  cuzk_orto:
    type: tile
    grid: geoportal_cuzk_cz_wtms_grid
    url: 'http://geoportal-orto.cuzk.cz/WMTS_ORTOFOTO/service.svc/get?SERVICE=WMTS&REQUEST=GetTile&VERSION=1.0.0&LAYER=orto&STYLE=default&TILEMATRIXSET=jtsk:epsg:5514&TILEMATRIX=%(z)s&TILEROW=%(y)s&TILECOL=%(x)s&FORMAT=image/jpeg'
    on_error:
      other:
        response: '#ffffff'

grids:
  sjtsk_grid:
    srs: EPSG:5514
    bbox: [-1068377.92, -1407484.928, -19670.848, -883131.392]
    origin: nw
    num_levels: 20
  geoportal_cuzk_cz_wtms_grid:
    srs: EPSG:5514
    bbox: [-925000.0, -1444353.536, -400646.464, -920000.0]
    origin: nw
    res: [
      # res             level dominator             * 0.00028
      2048.256,       #  0    7315200.0000000000000
      1024.128,       #  1    3657600.0000000000000
       512.064,       #  2    1828800.0000000000000
       256.032,       #  3     914400.0000000000000
       128.016,       #  4     457200.0000000000000
        64.008,       #  5     228600.0000000000000
        32.004,       #  6     114300.0000000000000
        16.002,       #  7      57150.0000000000000
         8.001,       #  8      28575.0000000000000
         4.0005,      #  9      14287.5000000000000
         2.00025,     # 10       7143.7500000000000
         1.000125,    # 11       3571.8750000000000
         0.5000625,   # 12       1785.9375000000000
         0.25003125,  # 13        892.9687500000000
         0.125015625, # 14        446.4843750000000
    ]

globals:
  image:
    resampling_method: bilinear
    formats:
      mergedpng:
        format: image/png
        mode: P
