Sources

MapProxy supports the following sources:

You need to choose a unique name for each configured source. This name will be used to reference the source in the caches and layers configuration.

The sources section looks like:

sources:
  mysource1:
    type: xxx
    type_dependend_option1: a
    type_dependend_option2: b
  mysource2:
    type: yyy
    type_dependend_option3: c

See below for a detailed description of each service.

WMS

Use the type wms to for WMS servers.

req

This describes the WMS source. The only required options are url and layers. You need to set transparent to true if you want to use this source as an overlay.

req:
  url: http://example.org/service?
  layers: base,roads
  transparent: true

All other options are added to the query string of the request.

req:
  url: http://example.org/service?
  layers: roads
  styles: simple
  map: /path/to/mapfile

You can also configure sld or sld_body parameters, in this case you can omit layers. sld can also point to a file://-URL. MapProxy will read this file and use the content as the sld_body. See sources with SLD for more information.

wms_opts

This option affects what request MapProxy sends to the source WMS server.

version
The WMS version number used for requests (supported: 1.0.0, 1.1.0, 1.1.1, 1.3.0). Defaults to 1.1.1.
legendgraphic
If this is set to true, MapProxy will request legend graphics from this source. Each MapProxy WMS layer that contains one or more sources with legend graphics will then have a LegendURL.
legendurl
Configure a URL to an image that should be returned as the legend for this source. Local URLs (file://) are also supported.
map
If this is set to false, MapProxy will not request images from this source. You can use this option in combination with featureinfo: true to create a source that is only used for feature info requests.
featureinfo
If this is set to true, MapProxy will mark the layer as queryable and incoming GetFeatureInfo requests will be forwarded to the source server.
featureinfo_xslt
Path to an XSLT script that should be used to transform incoming feature information.
featureinfo_format
The INFO_FORMAT for FeatureInfo requests. By default MapProxy will use the same format as requested by the client.

New in version 1.0.0: featureinfo_xslt and featureinfo_format

See FeatureInformation for more information.

coverage

Define the covered area of the source. The source will only be requested if there is an intersection between the requested data and the coverage. See coverages for more information about the configuration. The intersection is calculated for meta-tiles and not the actual client request, so you should expect more visible data at the coverage boundaries.

seed_only

Disable this source in regular mode. If set to true, this source will always return a blank/transparent image. The source will only be requested during the seeding process. You can use this option to run MapProxy in an offline mode.

min_res, max_res or min_scale, max_scale

Limit the source to the given min and max resolution or scale. MapProxy will return a blank image for requests outside of these boundaries. You can use either the resolution or the scale values, missing values will be interpreted as unlimited. Resolutions should be in meters per pixel.

The values will also apear in the capabilities documents (i.e. WMS ScaleHint and Min/MaxScaleDenominator). The boundaries will be regarded for each source, but the values in the capabilities might differ if you combine multiple sources or if the MapProxy layer already has a min/max_res configuration.

Pleas read scale vs. resolution for some notes on scale.

supported_srs

A list with SRSs that the WMS source supports. MapProxy will only query the source in these SRSs. It will reproject data if it needs to get data from this layer in any other SRS.

You don’t need to configure this if you only use this WMS as a cache source and the WMS supports all SRS of the cache.

If MapProxy needs to reproject and the source has multiple supported_srs, then it will use the fist projected SRS for requests in projected SRS, or the fist geographic SRS for requests in geographic SRS. E.g when supported_srs is ['EPSG:4326', 'EPSG:31467'] caches with EPSG:900913 will use EPSG:32467.

supported_format

Use this option to specify which image formats you source WMS supports. MapProxy only requests images in one of these formats, and will convert any image if it needs another format. If you do not supply this options, MapProxy assumes that the source supports all formats.

image.transparent_color

New in version 1.0.0.

Specify a color that should be converted to full transparency. Can be either a list of color ([255, 255, 255]) values or a hex string (#ffffff).

image.transparent_color_tolerance

New in version 1.0.0.

Tolerance for the transparent_color substitution. The value defines the tolerance in each direction. E.g. a tolerance of 5 and a color value of 100 will convert colors in the range of 95 to 105.

image.opacity

New in version 1.0.0.

Configures the opacity of this source image. This value is used when the image is placed on other layers and it can be used to overlay non-transparent images. The value should be between 0.0 (full transparent) and 1.0 (opaque, i.e. the layers below will not be rendered).

concurrent_requests

This limits the number of parallel requests MapProxy will issue to the source server. It even works across multiple WMS sources as long as all have the same concurrent_requests value and all req.url parameters point to the same host. Defaults to 0, which means no limitation.

http

You can configure the following HTTP related options for this source:

  • method
  • headers
  • client_timeout
  • ssl_ca_certs
  • ssl_no_cert_check (see below)

See HTTP Options for detailed documentation.

http.ssl_no_cert_check

MapProxy checks the SSL server certificates for any req.url that use HTTPS. You need to supply a file (see) that includes that certificate, otherwise MapProxy will fail to establish the connection. You can set the http.ssl_no_cert_check options to true to disable this verification.

Example configuration

Minimal example:

my_minimal_wmssource:
  type: wms
  req:
    url: http://localhost:8080/service?
    layers: base

Full example:

my_wmssource:
  type: wms
  wms_opts:
    version: 1.0.0
    featureinfo: True
  supported_srs: ['EPSG:4326', 'EPSG:31467']
  image:
    transparent_color: '#ffffff'
    transparent_color_tolerance: 0
  coverage:
     polygons: GM.txt
     polygons_srs: EPSG:900913
  req:
    url: http://localhost:8080/service?mycustomparam=foo
    layers: roads
    another_param: bar
    transparent: true

Tiles

Use the type tile to request data from from existing tile servers like TileCache and GeoWebCache. You can also use this source cascade MapProxy installations.

url

This source takes a url option that contains a URL template. The template format is %(key_name)s. MapProxy supports the following named variables in the URL:

x, y, z
The tile coordinate.
format
The format of the tile.
quadkey
Quadkey for the tile as described in http://msdn.microsoft.com/en-us/library/bb259689.aspx
tc_path
TileCache path like 09/000/000/264/000/000/345. Note that it does not contain any format extension.
tms_path
TMS path like 5/12/9. Note that it does not contain the version, the layername or the format extension.

Additionally you can specify the origin of the tile grid with the origin option. Supported values are sw for south-west (lower-left) origin or nw for north-west (upper-left) origin. sw is the default.

grid

The grid of the tile source. Defaults to GLOBAL_MERCATOR, a grid that is compatible with popular web mapping applications.

coverage

Define the covered area of the source. The source will only be requested if there is an intersection between the incoming request and the coverage. See coverages for more information.

transparent

New in version 1.0.0.

You need to set this to true if you want to use this source as an overlay.

image.opacity

New in version 1.0.0.

Configures the opacity of this source image. This value is used when the image is placed on other layers and it can be used to overlay non-transparent images. The value should be between 0.0 (full transparent) and 1.0 (opaque, i.e. the layers below will not be rendered).

http

You can configure the following HTTP related options for this source:

  • headers
  • client_timeout
  • ssl_ca_certs
  • ssl_no_cert_check (see above)

See HTTP Options for detailed documentation.

seed_only

See seed_only

Example configuration

my_tile_source:
  type: tile
  grid: mygrid
  url: http://localhost:8080/tile?x=%(x)s&y=%(y)s&z=%(z)s&format=%(format)s
  origin: nw

Debug

Adds information like resolution and BBOX to the response image. This is useful to determine a fixed set of resolutions for the res-parameter. It takes no options.

Example:

debug_source:
  type: debug