Export to GitHub

twms - Config.wiki


Common things

  • debug boolean - if True, TWMS will probably be more verbose than usually
  • tiles_cache string - path where tiles cache in tWMS format is accessible
  • install_path string - path to different stuff shipped with tWMS, like broken tile samples and so on
  • gpx_cache string - path to directory where tWMS should store OSM gpx files cache if asked to render
  • deadline float - number of seconds when outer downloads are permitted. After that number image is constructed of what is alreade in cache. Useful for programs like QGIS which have 60-second WMS timeout
  • default_max_zoom int - default value of max_zoom. Can be overridden per-layer.
  • geometry_color dict - colors that WKT renderer should use to render each geometry. contains "GEOMETRY_TYPE": "PIL color string", pairs;

  • default_layers string - default value for LAYERS= request string. If empty, overview HTML page is shown.

  • max_height int maximal allowed requested height
  • max_width int maximal allowed requested width
  • output_quality int - output image compression quality (matters for JPEG)
  • output_progressive bool - should image be progressive? (matters for JPEG)
  • output_optimize bool - should image be optimized? (matters for PNG)
  • default_background PIL color string - default background color for empty space
  • default_vector_renderer string - what library to use for vector rasterization - "cairo" or "PIL"
  • default_format string - default image MIME-type, like "image/jpeg"

    stuff used for GetCapabilities

  • service_url string - base URL service installed at

  • wms_name string - name of WMS service
  • default_bbox 4326-bbox tuple - area to which service should be announced to restricted
  • contact_person dict - info about whom to contact
    • mail string - announced e-mail
    • real_name string - announced admin's real name
    • organization string - announced service owner organization

Layers description

All accessible layers should be mentioned in layers dict in format "Layer_name": {describing dict}

Available describing dict options: * name string - visible layer name * prefix string - cache tile subdirectory name * ext string - tile image files extension * scalable bool - if True, tWMS will try to construct tile of better ones if they are available (better for home use and satellite images, or scanned maps). If False, tWMS will use nearest zoom level (better for rasterized vector maps and production servers) * proj string - EPSG code of layer tiles projection. * min_zoom int - the worst zoom level number service provides * max_zoom int - the best zoom level number service provides * empty_color PIL color string - if this layer is overlayed over another, this color will be considered transparent. Also used for dead tile detection in fetchers.WMS * cache_ttl sencons - time that cache will be considered valid * cached bool - if False, layer won't be cached. Good in combinations with local WMS or tile services to add tWMS features to them * data_bounding_box 4326-bbox tuple - no fetching will be performed outside this bbox. Good when caching just one country or a single satellite image. * fetch function (z, x, y, layer_dict) - function that fetches given tile. should return None if tile wasn't fetched.

tWMS has a number of pre-written fetchers: * fetchers.Tile - designed for services that provide images over tile protocol, like http://kosmosnimki.ru or http://maps.yahoo.com. Uses following parameters from layer dict: * remote_url string - Base tiles URL. May contain python placeholders like "%s" * transform_tile_number function (x, y, z) - function (usually lambda) that returns tuple that will be substituted into remote_url. If omitted, (z,x,y) tuple is used. * dead_tile filename - file which contains broken (empty) tile for this service. If server responds with this data, it will not be saved into cache; negative mark will be saved instead. * fetchers.WMS * remote_url string - Base WMS URL. A GetMap request with omitted srs, height, width and bbox. Should probably end in "?" or "&". * wms_proj string - what projection to use when asking images from WMS. Note that images probably won't be properly reprojected if it differs from proj. Helps to cope with broken WMS services.