There are a few different configuration files used by MapProxy. Some are required and some are optional.
All layers the proxy offers are configured in this file. The configuration uses the YAML format.
The configuration contains the keys service and layers.
Here is an example for the service part:
service:
attribution:
text: "© MyCompany"
md:
title: MapProxy WMS Proxy
abstract: This is the fantastic MapProxy.
online_resource: http://mapproxy.org/
contact:
person: Your Name Here
position: Technical Director
organization:
address: Fakestreet 123
city: Somewhere
postcode: 12345
country: Germany
phone: +49(0)000-000000-0
fax: +49(0)000-000000-0
email: you@example.org
access_constraints: This service is intended for private and evaluation use only.
fees: 'None'
Adds an attribution (copyright) line to all WMS requests.
md is for metadata. These fields are used for the WMS GetCapabilities responses. See the above example for all supported keys.
Here you can define all layers the proxy should offer. The key of each layer is also the name of the layer, i.e. the name used in WMS layers argument.
Each configuration item contains information about the layer (e.g. name), how the layer is cached (e.g. in which SRS) and where the data comes from (e.g. which WMS-Server).
Metadata for this layer. At the moment only title ist supported. It will be used as the human readable name for WMS layers.
Unter param werden Parameter für die Datenquelle und den Zwischenspeicher gesetzt.
The spatial reference system used for the internal cache. You can define multiple SRSs here. One cache is created for each.:
srs: EPSG:4326
or
srs: ['EPSG:4326', 'EPSG:900913']
MapProxy supports on-the-fly transformation of requests between different SRSs. So it is not required to add an extra cache for each supported SRS. For best performance only the SRS most requests are in should be used.
There is some special handling layers that need geographical and projected coordinate systems. If you set both EPSG:4326 and EPSG:900913 all requests with projected SRS will access the EPSG:900913 cache, requests with geographical SRS will use EPSG:4326. The distortions from the transformation should be acceptable these to cached SRS.
The resolution for which MapProxy should cache tiles. For requests with no matching cached resolution the next best resolution is used and MapProxy will transform the result. There are three ways to configure the resolutions.
1. A factor between each resolution. With each step the resolution is multiplied by this factor. Defaults to 2.
2. A list with resolutions in units per pixel (degrees or meter per pixel). The units from the first configured srs are used.
3. The term sqrt2. This option is a shorthand for a resolution factor of 1.4142 (i.e. square root of two). With this factor the resolution doubles every second level. Compared to the default factor 2 you will get another cached level between all standard levels. This is suited for free zooming in vector-based layers where the results might look to blurry/pixelated in some resolutions.
You define the data sources of each layer here. The configuration ref:is explained below <sources-conf-label>.
Overwrite the system-wide attribution line for this layer.
Add a watermark right into the cached data. The watermark is thus also present in TMS or KML requests.
Every layer contains one or more sources. The sources define where the proxy should get the data for this layer. Each layer has a type.
MapProxy support the following types:
A direct source passes all requests to the configured WMS server and does not cache any data. req defines the source WMS URL and the layers that should be requested.
Example:
- type: direct
req:
url: http://servername/service
layers: poi,roads
The cache_wms source passes requests to a WMS server and caches all data for further requests.
This option affects what request the proxy sends to the source WMS server.
version is the WMS version number used for requests (supported: 1.0.0, 1.1.1, 1.3.0). If featureinfo is true, MapProxy will mark the layer as queryable and incoming GetFeatureInfo requests will be forwarded to the source server.
Example:
- type: cache_wms
wms_opts:
version: 1.0.0
featureinfo: True
req:
url: http://localhost:8080/service?
layers: roads
transparent: 'true'
Adds information like resolution and bbox to the response image. This is useful to determine a fixed set of resolutions for the res-parameter.