This file is indexed.

/usr/share/doc/mapproxy/html/tutorial.html is in mapproxy-doc 1.9.0-3+deb9u1.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
<!DOCTYPE html>


<html xmlns="http://www.w3.org/1999/xhtml">
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    
    <title>Tutorial &#8212; MapProxy 1.8.2a0 Docs</title>
    
    <link rel="stylesheet" href="_static/basic.css" type="text/css" />
    <link rel="stylesheet" href="_static/pygments.css" type="text/css" />
    <link rel="stylesheet" href="_static/bootstrap-3.3.6/css/bootstrap.min.css" type="text/css" />
    <link rel="stylesheet" href="_static/bootstrap-3.3.6/css/bootstrap-theme.min.css" type="text/css" />
    <link rel="stylesheet" href="_static/bootstrap-sphinx.css" type="text/css" />
    <link rel="stylesheet" href="_static/mapproxy.css" type="text/css" />
    
    <script type="text/javascript">
      var DOCUMENTATION_OPTIONS = {
        URL_ROOT:    './',
        VERSION:     '1.8.2a0',
        COLLAPSE_INDEX: false,
        FILE_SUFFIX: '.html',
        HAS_SOURCE:  true
      };
    </script>
    <script type="text/javascript" src="_static/jquery.js"></script>
    <script type="text/javascript" src="_static/underscore.js"></script>
    <script type="text/javascript" src="_static/doctools.js"></script>
    <script type="text/javascript" src="_static/js/jquery-1.11.0.min.js"></script>
    <script type="text/javascript" src="_static/js/jquery-fix.js"></script>
    <script type="text/javascript" src="_static/bootstrap-3.3.6/js/bootstrap.min.js"></script>
    <script type="text/javascript" src="_static/bootstrap-sphinx.js"></script>
    <link rel="index" title="Index" href="genindex.html" />
    <link rel="search" title="Search" href="search.html" />
    <link rel="top" title="MapProxy 1.8.2a0 Docs" href="index.html" />
    <link rel="next" title="Configuration" href="configuration.html" />
    <link rel="prev" title="Installation on OSGeo4W" href="install_osgeo4w.html" />
<meta charset='utf-8'>
<meta http-equiv='X-UA-Compatible' content='IE=edge,chrome=1'>
<meta name='viewport' content='width=device-width, initial-scale=1.0, maximum-scale=1'>
<meta name="apple-mobile-web-app-capable" content="yes">

  </head>
  <body role="document">

<div id="navbar" class="navbar navbar-default ">
  <div class="container">
    <div class="navbar-header">
      <!-- .btn-navbar is used as the toggle for collapsed navbar content -->
      <button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".nav-collapse">
        <span class="icon-bar"></span>
        <span class="icon-bar"></span>
        <span class="icon-bar"></span>
      </button>
      <a href="index.html" class="pull-left"><img src="_static/logo.png" height="50">
      </a>
      <a class="navbar-brand" href="index.html">
        <span>
          MapProxy</span>
        <span>1.8.2a0</span>
      </a>
    </div>
    <div class="collapse navbar-collapse nav-collapse">
      
        
<form class="navbar-form navbar-right" action="search.html" method="get">
 <div class="form-group">
  <input type="text" name="q" class="form-control" placeholder="Search" />
 </div>
  <input type="hidden" name="check_keywords" value="yes" />
  <input type="hidden" name="area" value="default" />
</form>
      
    </div>
  </div>
</div>

<div class="container">
  <div class="row">
      <div class="col-md-3">
        <div id="sidebar" class="bs-sidenav" role="complementary"><ul class="current">
<li class="toctree-l1"><a class="reference internal" href="install.html">Installation</a></li>
<li class="toctree-l1"><a class="reference internal" href="install_windows.html">Installation on Windows</a></li>
<li class="toctree-l1"><a class="reference internal" href="install_osgeo4w.html">Installation on OSGeo4W</a></li>
<li class="toctree-l1 current"><a class="current reference internal" href="#">Tutorial</a><ul>
<li class="toctree-l2"><a class="reference internal" href="#configuration-format">Configuration format</a></li>
<li class="toctree-l2"><a class="reference internal" href="#configuration-layout">Configuration Layout</a></li>
<li class="toctree-l2"><a class="reference internal" href="#example-configuration">Example Configuration</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="configuration.html">Configuration</a></li>
<li class="toctree-l1"><a class="reference internal" href="services.html">Services</a></li>
<li class="toctree-l1"><a class="reference internal" href="sources.html">Sources</a></li>
<li class="toctree-l1"><a class="reference internal" href="caches.html">Caches</a></li>
<li class="toctree-l1"><a class="reference internal" href="seed.html">Seeding</a></li>
<li class="toctree-l1"><a class="reference internal" href="coverages.html">Coverages</a></li>
<li class="toctree-l1"><a class="reference internal" href="mapproxy_util.html">mapproxy-util</a></li>
<li class="toctree-l1"><a class="reference internal" href="mapproxy_util_autoconfig.html">mapproxy-util autoconfig</a></li>
<li class="toctree-l1"><a class="reference internal" href="deployment.html">Deployment</a></li>
<li class="toctree-l1"><a class="reference internal" href="configuration_examples.html">Configuration examples</a></li>
<li class="toctree-l1"><a class="reference internal" href="inspire.html">INSPIRE View Service</a></li>
<li class="toctree-l1"><a class="reference internal" href="labeling.html">WMS Labeling</a></li>
<li class="toctree-l1"><a class="reference internal" href="auth.html">Authentication and Authorization</a></li>
<li class="toctree-l1"><a class="reference internal" href="decorate_img.html">Decorate Image</a></li>
<li class="toctree-l1"><a class="reference internal" href="development.html">Development</a></li>
<li class="toctree-l1"><a class="reference internal" href="mapproxy_2.html">MapProxy 2.0</a></li>
</ul>

        </div>
      </div>
    <div class="col-md-8">
      
  <div class="section" id="tutorial">
<h1>Tutorial<a class="headerlink" href="#tutorial" title="Permalink to this headline"></a></h1>
<p>This tutorial should give you a quick introduction to the MapProxy configuration.</p>
<p>You should have a <a class="reference internal" href="install.html"><span class="doc">working MapProxy installation</span></a>, if you want to follow this tutorial.</p>
<div class="section" id="configuration-format">
<h2>Configuration format<a class="headerlink" href="#configuration-format" title="Permalink to this headline"></a></h2>
<p>The configuration of MapProxy uses the YAML format. YAML is a superset of JSON. That means every valid
JSON is also valid YAML. MapProxy uses no advanced features of YAML, so you could
even use JSON. YAML uses a more readable and user-friendly syntax. We encourage
you to use it.</p>
<p>If you are familiar with YAML you can skip to the next section.</p>
<p>The YAML configuration consist of comments, dictionaries, lists, strings, numbers
and booleans.</p>
<div class="section" id="comments">
<h3>Comments<a class="headerlink" href="#comments" title="Permalink to this headline"></a></h3>
<p>Everything after a hash character (<code class="docutils literal"><span class="pre">#</span></code>) is a comment and will be ignored.</p>
</div>
<div class="section" id="numbers">
<h3>Numbers<a class="headerlink" href="#numbers" title="Permalink to this headline"></a></h3>
<p>Any numerical value like <code class="docutils literal"><span class="pre">12</span></code>, <code class="docutils literal"><span class="pre">-4</span></code>, <code class="docutils literal"><span class="pre">0</span></code>, and <code class="docutils literal"><span class="pre">3.1415</span></code>.</p>
</div>
<div class="section" id="strings">
<h3>Strings<a class="headerlink" href="#strings" title="Permalink to this headline"></a></h3>
<p>Any string within single or double quotes. You can omit the quotes if the string
has no other meaning in YAML syntax. For example:</p>
<div class="highlight-default"><div class="highlight"><pre><span></span><span class="s1">&#39;foo&#39;</span>
<span class="n">foo</span>
<span class="s1">&#39;43&#39;</span> <span class="c1"># with quotes, otherwise it would be numeric</span>
<span class="s1">&#39;[string, not a list]&#39;</span>
<span class="n">A</span> <span class="n">string</span> <span class="k">with</span> <span class="n">spaces</span> <span class="ow">and</span> <span class="n">punctuation</span><span class="o">.</span>
</pre></div>
</div>
</div>
<div class="section" id="booleans">
<h3>Booleans<a class="headerlink" href="#booleans" title="Permalink to this headline"></a></h3>
<p>True or false values:</p>
<div class="highlight-default"><div class="highlight"><pre><span></span><span class="n">yes</span>
<span class="n">true</span>
<span class="kc">True</span>
<span class="n">no</span>
<span class="n">false</span>
<span class="kc">False</span>
</pre></div>
</div>
</div>
<div class="section" id="list">
<h3>List<a class="headerlink" href="#list" title="Permalink to this headline"></a></h3>
<p>A list is a collection of other valid objects. There are two formats. The condensed
form uses square brackets:</p>
<div class="highlight-default"><div class="highlight"><pre><span></span><span class="p">[</span><span class="mi">1</span><span class="p">,</span> <span class="mi">2</span><span class="p">,</span> <span class="mi">3</span><span class="p">]</span>
<span class="p">[</span><span class="mi">42</span><span class="p">,</span> <span class="n">string</span><span class="p">,</span> <span class="p">[</span><span class="n">another</span> <span class="nb">list</span> <span class="k">with</span> <span class="n">a</span> <span class="n">string</span><span class="p">]]</span>
</pre></div>
</div>
<p>The block form requires every list item on a separate line, starting with
<code class="docutils literal"><span class="pre">-</span></code> (dash and a blank):</p>
<div class="highlight-default"><div class="highlight"><pre><span></span><span class="o">-</span> <span class="mi">1</span>
<span class="o">-</span> <span class="mi">2</span>
<span class="o">-</span> <span class="mi">3</span>

<span class="o">-</span> <span class="mi">42</span>
<span class="o">-</span> <span class="n">string</span>
<span class="o">-</span> <span class="p">[</span><span class="n">another</span> <span class="nb">list</span><span class="p">]</span>
</pre></div>
</div>
</div>
<div class="section" id="dictionaries">
<h3>Dictionaries<a class="headerlink" href="#dictionaries" title="Permalink to this headline"></a></h3>
<p>A dictionary maps keys to values. Values itself can be any valid object.</p>
<p>There are two formats. The condensed form uses braces:</p>
<div class="highlight-default"><div class="highlight"><pre><span></span><span class="p">{</span><span class="n">foo</span><span class="p">:</span> <span class="mi">3</span><span class="p">,</span> <span class="n">bar</span><span class="p">:</span> <span class="n">baz</span><span class="p">}</span>
</pre></div>
</div>
<p>The block form requires every key value pair on a seperate line:</p>
<div class="highlight-default"><div class="highlight"><pre><span></span><span class="n">foo</span><span class="p">:</span> <span class="mi">3</span>
<span class="n">bar</span><span class="p">:</span> <span class="n">baz</span>
</pre></div>
</div>
<p>You can also nest dictionaries. Each nested dictionary needs to be indented by one or more whitespaces. Tabs are <em>not</em> permitted and all keys to the same dictionary need to be indented by the same amount of spaces.</p>
<div class="highlight-default"><div class="highlight"><pre><span></span><span class="n">baz</span><span class="p">:</span>
  <span class="n">ham</span><span class="p">:</span> <span class="mi">2</span>
  <span class="n">spam</span><span class="p">:</span>
    <span class="n">bam</span><span class="p">:</span> <span class="kc">True</span>
  <span class="n">inside_baz</span><span class="p">:</span> <span class="s1">&#39;yepp&#39;</span>
</pre></div>
</div>
</div>
</div>
<div class="section" id="configuration-layout">
<h2>Configuration Layout<a class="headerlink" href="#configuration-layout" title="Permalink to this headline"></a></h2>
<p>The MapProxy configuration is a dictionary, each key configures a different aspect
of MapProxy. There are the following keys:</p>
<ul class="simple">
<li><dl class="first docutils">
<dt><code class="docutils literal"><span class="pre">services</span></code>:  This is the place to activate and configure MapProxy&#8217;s services</dt>
<dd>like WMS and TMS.</dd>
</dl>
</li>
<li><dl class="first docutils">
<dt><code class="docutils literal"><span class="pre">layers</span></code>: Configure the layers that MapProxy offers. Each layer can consist</dt>
<dd>of multiple sources and caches.</dd>
</dl>
</li>
<li><dl class="first docutils">
<dt><code class="docutils literal"><span class="pre">sources</span></code>:</dt>
<dd>Define where MapProxy can retrieve new data.</dd>
</dl>
</li>
<li><dl class="first docutils">
<dt><code class="docutils literal"><span class="pre">caches</span></code>:</dt>
<dd>Here you can configure the internal caches.</dd>
</dl>
</li>
<li><dl class="first docutils">
<dt><code class="docutils literal"><span class="pre">grids</span></code>: MapProxy aligns all cached images (tiles) to a grid. Here you can define</dt>
<dd>that grid.</dd>
</dl>
</li>
<li><dl class="first docutils">
<dt><code class="docutils literal"><span class="pre">globals</span></code>:  Here you can define some internals of MapProxy and default values</dt>
<dd>that are used in the other configuration directives.</dd>
</dl>
</li>
</ul>
<p>The order of the directives is not important, so you can organize it your way.</p>
</div>
<div class="section" id="example-configuration">
<h2>Example Configuration<a class="headerlink" href="#example-configuration" title="Permalink to this headline"></a></h2>
<div class="section" id="configuring-a-service">
<h3>Configuring a Service<a class="headerlink" href="#configuring-a-service" title="Permalink to this headline"></a></h3>
<p>At first we need to <a class="reference internal" href="services.html#services"><span class="std std-ref">configure at least one service</span></a>. To enable
a service, you have to include its name as a key in the <cite>services</cite> dictionary.
For example:</p>
<div class="highlight-default"><div class="highlight"><pre><span></span><span class="n">services</span><span class="p">:</span>
  <span class="n">tms</span><span class="p">:</span>
</pre></div>
</div>
<p>Each service is a YAML dictionary, with the service type as the key. The dictionary
can be empty, but you need to add the colon so that the configuration parser knows
it&#8217;s a dictionary.</p>
<p>A service might accept more configuration options. The WMS service, for example,
takes a dictionary with metadata. This data is used in the capabilities documents.</p>
<p>Here is an example with some contact information:</p>
<div class="highlight-default"><div class="highlight"><pre><span></span><span class="n">services</span><span class="p">:</span>
  <span class="n">wms</span><span class="p">:</span>
    <span class="n">md</span><span class="p">:</span>
        <span class="n">title</span><span class="p">:</span> <span class="n">MapProxy</span> <span class="n">WMS</span> <span class="n">Proxy</span>
        <span class="n">abstract</span><span class="p">:</span> <span class="n">This</span> <span class="ow">is</span> <span class="n">the</span> <span class="n">fantastic</span> <span class="n">MapProxy</span><span class="o">.</span>
        <span class="n">online_resource</span><span class="p">:</span> <span class="n">http</span><span class="p">:</span><span class="o">//</span><span class="n">mapproxy</span><span class="o">.</span><span class="n">org</span><span class="o">/</span>
        <span class="n">contact</span><span class="p">:</span>
            <span class="n">person</span><span class="p">:</span> <span class="n">Your</span> <span class="n">Name</span> <span class="n">Here</span>
            <span class="n">position</span><span class="p">:</span> <span class="n">Technical</span> <span class="n">Director</span>
            <span class="n">organization</span><span class="p">:</span> 
            <span class="n">address</span><span class="p">:</span> <span class="n">Fakestreet</span> <span class="mi">123</span>
            <span class="n">city</span><span class="p">:</span> <span class="n">Somewhere</span>
            <span class="n">postcode</span><span class="p">:</span> <span class="mi">12345</span>
            <span class="n">country</span><span class="p">:</span> <span class="n">Germany</span>
            <span class="n">phone</span><span class="p">:</span> <span class="o">+</span><span class="mi">49</span><span class="p">(</span><span class="mi">0</span><span class="p">)</span><span class="mi">000</span><span class="o">-</span><span class="mi">000000</span><span class="o">-</span><span class="mi">0</span>
            <span class="n">fax</span><span class="p">:</span> <span class="o">+</span><span class="mi">49</span><span class="p">(</span><span class="mi">0</span><span class="p">)</span><span class="mi">000</span><span class="o">-</span><span class="mi">000000</span><span class="o">-</span><span class="mi">0</span>
            <span class="n">email</span><span class="p">:</span> <span class="n">info</span><span class="nd">@omniscale</span><span class="o">.</span><span class="n">de</span>
        <span class="n">access_constraints</span><span class="p">:</span>
            <span class="n">This</span> <span class="n">service</span> <span class="ow">is</span> <span class="n">intended</span> <span class="k">for</span> <span class="n">private</span> <span class="ow">and</span>
            <span class="n">evaluation</span> <span class="n">use</span> <span class="n">only</span><span class="o">.</span> <span class="n">The</span> <span class="n">data</span> <span class="ow">is</span> <span class="n">licensed</span>
            <span class="k">as</span> <span class="n">Creative</span> <span class="n">Commons</span> <span class="n">Attribution</span><span class="o">-</span><span class="n">Share</span> <span class="n">Alike</span> <span class="mf">2.0</span>
            <span class="p">(</span><span class="n">http</span><span class="p">:</span><span class="o">//</span><span class="n">creativecommons</span><span class="o">.</span><span class="n">org</span><span class="o">/</span><span class="n">licenses</span><span class="o">/</span><span class="n">by</span><span class="o">-</span><span class="n">sa</span><span class="o">/</span><span class="mf">2.0</span><span class="o">/</span><span class="p">)</span>
        <span class="n">fees</span><span class="p">:</span> <span class="s1">&#39;None&#39;</span>
</pre></div>
</div>
<p><cite>access_constraints</cite> demonstrates how you can write a string over multiple lines,
just indent every line the same way as the first. And remember, YAML does not
accept tab characters, you must use space.</p>
<p>For this tutorial we add another service called <cite>demo</cite>. This is a demo service
that lists all configured WMS and TMS layers. You can test each layer with a
simple OpenLayers client. So our configuration file should look like:</p>
<div class="highlight-default"><div class="highlight"><pre><span></span><span class="n">services</span><span class="p">:</span>
  <span class="n">demo</span><span class="p">:</span>
  <span class="n">wms</span><span class="p">:</span>
    <span class="p">[</span><span class="n">rest</span> <span class="n">of</span> <span class="n">WMS</span> <span class="n">configuration</span><span class="p">]</span>
</pre></div>
</div>
</div>
<div class="section" id="adding-a-source">
<h3>Adding a Source<a class="headerlink" href="#adding-a-source" title="Permalink to this headline"></a></h3>
<p>Next you need to <a class="reference internal" href="sources.html#sources"><span class="std std-ref">define the source</span></a> of your data. Every source has
a name and a type. Let&#8217;s add a WMS source:</p>
<div class="highlight-default"><div class="highlight"><pre><span></span>sources:
  test_wms:
    type: wms
    req:
      url: http://osm.omniscale.net/proxy/service?
      layers: osm
</pre></div>
</div>
<p>In this example <cite>test_wms</cite> is the name of the source, you need this name later
to reference it. Most sources take more parameters – some are optional, some are
required. The type <cite>wms</cite> requires the <cite>req</cite> parameter that describes the WMS
request. You need to define at least a URL and the layer names, but you can add
more options like <cite>transparent</cite> or <cite>format</cite>.</p>
</div>
<div class="section" id="adding-a-layer">
<h3>Adding a Layer<a class="headerlink" href="#adding-a-layer" title="Permalink to this headline"></a></h3>
<p>After defining a source we can use it to <a class="reference internal" href="configuration.html#layers-section"><span class="std std-ref">create a layer</span></a> for the
MapProxy WMS.</p>
<p>A layer requires a title, which will be used in the capabilities documents and
a source. For this layer we want to use our <cite>test_wms</cite> data source:</p>
<div class="highlight-default"><div class="highlight"><pre><span></span><span class="n">layers</span><span class="p">:</span>
  <span class="o">-</span> <span class="n">name</span><span class="p">:</span> <span class="n">cascaded_test</span>
    <span class="n">title</span><span class="p">:</span> <span class="n">Cascaded</span> <span class="n">Test</span> <span class="n">Layer</span>
    <span class="n">sources</span><span class="p">:</span> <span class="p">[</span><span class="n">test_wms</span><span class="p">]</span>
</pre></div>
</div>
<p>Now we have setuped MapProxy as cascading WMS. That means MapProxy only redirect
requests to the WMS defined in <cite>test_wms</cite> data source.</p>
</div>
<div class="section" id="starting-the-development-server">
<h3>Starting the development server<a class="headerlink" href="#starting-the-development-server" title="Permalink to this headline"></a></h3>
<p>That&#8217;s it for the first configuration, you can now <a class="reference internal" href="mapproxy_util.html#mapproxy-util"><span class="std std-ref">start MapProxy</span></a>:</p>
<div class="highlight-default"><div class="highlight"><pre><span></span><span class="n">mapproxy</span><span class="o">-</span><span class="n">util</span> <span class="n">serve</span><span class="o">-</span><span class="n">develop</span> <span class="n">mapproxy</span><span class="o">.</span><span class="n">yaml</span>
</pre></div>
</div>
<p>You can <a class="reference download internal" href="_downloads/simple_conf.yaml" download=""><code class="xref download docutils literal"><span class="pre">download</span> <span class="pre">the</span> <span class="pre">configuration</span></code></a>.</p>
<p>When you type <cite>localhost:8080/demo/</cite> in the URL of your webbrowser you should
see a demo site like shown below.</p>
<img alt="_images/mapproxy-demo.png" src="_images/mapproxy-demo.png" />
<p>Here you can see the capabilities of your configured service and watch it in action.</p>
</div>
<div class="section" id="adding-a-cache">
<h3>Adding a Cache<a class="headerlink" href="#adding-a-cache" title="Permalink to this headline"></a></h3>
<p>To speed up the source with MapProxy we <a class="reference internal" href="configuration.html#caches"><span class="std std-ref">create a cache</span></a> for this
source.</p>
<p>Each cache needs to know where it can get new data and how it should be cached.
We define our <cite>test_wms</cite> as source for the cache. MapProxy splits images in
small tiles and these tiles will be aligned to a grid. It also caches images in
different resolutions, like an image pyramid. You can define this image pyramid
in detail but we start with one of the default grid definitions of MapProxy.
<cite>GLOBAL_GEODETIC</cite> defines a grid that covers the whole world. It uses EPSG:4326
as the spatial reference system and aligns with the default grid and resolutions that OpenLayers
uses.</p>
<p>Our cache configuration should now look like:</p>
<div class="highlight-default"><div class="highlight"><pre><span></span><span class="n">caches</span><span class="p">:</span>
  <span class="n">test_wms_cache</span><span class="p">:</span>
    <span class="n">sources</span><span class="p">:</span> <span class="p">[</span><span class="n">test_wms</span><span class="p">]</span>
    <span class="n">grids</span><span class="p">:</span> <span class="p">[</span><span class="n">GLOBAL_GEODETIC</span><span class="p">]</span>
</pre></div>
</div>
</div>
<div class="section" id="adding-a-cached-layer">
<h3>Adding a cached Layer<a class="headerlink" href="#adding-a-cached-layer" title="Permalink to this headline"></a></h3>
<p>We can now use our defined cache as source for a layer. When the layer is
requested by a client, MapProxy looks in the cache for the requested data and only if
it hasn&#8217;t cached the data yet, it requests the <cite>test_wms</cite> data source.</p>
<p>The layer configuration should now look like:</p>
<div class="highlight-default"><div class="highlight"><pre><span></span><span class="n">layers</span><span class="p">:</span>
  <span class="o">-</span> <span class="n">name</span><span class="p">:</span> <span class="n">test_wms_cache</span>
    <span class="n">title</span><span class="p">:</span> <span class="n">Cached</span> <span class="n">Test</span> <span class="n">Layer</span>
    <span class="n">sources</span><span class="p">:</span> <span class="p">[</span><span class="n">test_wms_cache</span><span class="p">]</span>
</pre></div>
</div>
<p>You can <a class="reference download internal" href="_downloads/cache_conf.yaml" download=""><code class="xref download docutils literal"><span class="pre">download</span> <span class="pre">the</span> <span class="pre">configuration</span></code></a>.</p>
</div>
<div class="section" id="defining-resolutions">
<h3>Defining Resolutions<a class="headerlink" href="#defining-resolutions" title="Permalink to this headline"></a></h3>
<p>By default MapProxy caches traditional power-of-two image pyramids with a default
number of cached resolutions of 20. The resolutions
between each pyramid level doubles. If you want to change this, you can do so by
<a class="reference internal" href="configuration.html#id6"><span class="std std-ref">defining your own grid</span></a>. Fortunately MapProxy grids provied the
ability to inherit from an other grid. We let our grid inherit from the previously
used <cite>GLOBAL_GEODETIC</cite> grid and add five fixed resolutions to it.</p>
<p>The grid configuration should look like:</p>
<div class="highlight-default"><div class="highlight"><pre><span></span><span class="n">grids</span><span class="p">:</span>
  <span class="n">res_grid</span><span class="p">:</span>
    <span class="n">base</span><span class="p">:</span> <span class="n">GLOBAL_GEODETIC</span>
    <span class="n">res</span><span class="p">:</span> <span class="p">[</span><span class="mi">1</span><span class="p">,</span> <span class="mf">0.5</span><span class="p">,</span> <span class="mf">0.25</span><span class="p">,</span> <span class="mf">0.125</span><span class="p">,</span> <span class="mf">0.0625</span><span class="p">]</span>
</pre></div>
</div>
<p>As you see, we used <cite>base</cite> to inherit from <cite>GLOBAL_GEODETIC</cite> and <cite>res</cite> to define
our preferred resolutions. The resolutions are always in the unit of the SRS, in
this case in degree per pixel. You can use the <a class="reference internal" href="mapproxy_util.html#mapproxy-util-scales"><span class="std std-ref">MapProxy scales util</span></a>
to convert between scales and resolutions.</p>
<p>Instead of defining fixed resolutions, we can also define a factor that is used
to calculate the resolutions. The default value of this factor is 2, but you can
set it to each value you want. Just change <cite>res</cite> with <cite>res_factor</cite> and add your
preferred factor after it.</p>
<p>A magical value of <cite>res_factor</cite> is <strong>sqrt2</strong>, the square root of two. It doubles
the number of cached resolutions, so you have 40 instead of 20 available resolutions.
Every second resolution is identical to the power-of-two resolutions, so you can
use this layer not only in classic WMS clients with free zomming, but also in tile-based clients
like OpenLayers which only request in these resolutions. Look at the <a class="reference internal" href="configuration_examples.html#cache-resolutions"><span class="std std-ref">configuration
examples for vector data for more information</span></a>.</p>
</div>
<div class="section" id="defining-a-grid">
<h3>Defining a Grid<a class="headerlink" href="#defining-a-grid" title="Permalink to this headline"></a></h3>
<p>In the previous section we saw how to extend a grid to provide self defined
resolutions, but sometimes <cite>GLOBAL_GEODETIC</cite> grid is not useful because it covers
the whole world and we want only a part of it. So let&#8217;s see how to <a class="reference internal" href="configuration.html#id6"><span class="std std-ref">define our own grid</span></a>.</p>
<p>For this example we define a grid for Germany. We need a spatial reference system (<cite>srs</cite>)
that match the region of Germany and a bounding box (<cite>bbox</cite>) around Germany to limit
the requestable aera. To make the specification of the <cite>bbox</cite> a little bit easier,
we put the <cite>bbox_srs</cite> parameter to the grid configuration. So we can define the
<cite>bbox</cite> in EPSG:4326.</p>
<p>The <cite>grids</cite> configuration is a dictionary and each grid configuration is identified
by its name. We call our grid <cite>germany</cite> and its configuration should look like:</p>
<div class="highlight-default"><div class="highlight"><pre><span></span><span class="n">grids</span><span class="p">:</span>
  <span class="n">germany</span><span class="p">:</span>
    <span class="n">srs</span><span class="p">:</span> <span class="s1">&#39;EPSG:25832&#39;</span>
    <span class="n">bbox</span><span class="p">:</span> <span class="p">[</span><span class="mi">6</span><span class="p">,</span> <span class="mf">47.3</span><span class="p">,</span> <span class="mf">15.1</span><span class="p">,</span> <span class="mi">55</span><span class="p">]</span>
    <span class="n">bbox_srs</span><span class="p">:</span> <span class="s1">&#39;EPSG:4326&#39;</span>
</pre></div>
</div>
<p>We have to replace <cite>GLOBAL_GEODETIC</cite> in the cache configuration with our
<cite>germany</cite> grid. After that MapProxy caches all data in UTM32.</p>
<p>MapProxy request the source in the projection of the grid. You can configure
<a class="reference internal" href="sources.html#supported-srs"><span class="std std-ref">the supported SRS for each WMS source</span></a> and MapProxy
takes care of any transformations if the <cite>srs</cite> of our grid is
different from the data source.</p>
<p>You can <a class="reference download internal" href="_downloads/grid_conf.yaml" download=""><code class="xref download docutils literal"><span class="pre">download</span> <span class="pre">the</span> <span class="pre">configuration</span></code></a>.</p>
</div>
<div class="section" id="merging-multiple-layers">
<h3>Merging Multiple Layers<a class="headerlink" href="#merging-multiple-layers" title="Permalink to this headline"></a></h3>
<p>If you have two WMS and want to offer a single layer with data from both server,
you can combine these in one cache. MapProxy will combine the images before it stores
the tiles on disk. The sources should be defined from bottom to top and
all sources except the bottom need to be transparent.</p>
<p>The code below is an example for configure MapProxy to combine two WMS in one
cache and one layer:</p>
<div class="highlight-default"><div class="highlight"><pre><span></span>services:
  wms:
  demo:
    
sources:
  test_wms:
    type: wms
    req:
      url: http://osm.omniscale.net/proxy/service?
      layers: osm
  roads_wms:
    type: wms
    req:
      url: http://osm.omniscale.net/proxy/service?
      layers: osm_roads
      transparent: true

caches:
  combined_cache:
    sources: [test_wms, roads_wms]
    grids: [GLOBAL_GEODETIC]

layers:
  - name: cached_test_wms_with_roads
    title: Cached Test WMS with Roads
    sources: [combined_cache]
</pre></div>
</div>
<p>You can <a class="reference download internal" href="_downloads/merged_conf.yaml" download=""><code class="xref download docutils literal"><span class="pre">download</span> <span class="pre">the</span> <span class="pre">configuration</span></code></a>.</p>
</div>
<div class="section" id="coverages">
<h3>Coverages<a class="headerlink" href="#coverages" title="Permalink to this headline"></a></h3>
<p>Sometimes you don&#8217;t want to provide the full data of a WMS in a layer. With
MapProxy you can define areas where data is available or where data you are
interested in is. MapProxy provides three ways to restrict the area of available
data: Bounding boxes, polygons and OGR datasource. To keep it simple, we only
discuss bounding boxes. For more informations about the other methods take
a look at <a class="reference internal" href="coverages.html#coverages"><span class="std std-ref">the coverages documentation</span></a>.
To restrict the area with a bounding box, we have to define it in the coverage
option of the data source. The listing below restricts the requestable area to
Germany:</p>
<div class="highlight-default"><div class="highlight"><pre><span></span>sources:
  test_wms:
    type: wms
    req:
      url: http://osm.omniscale.net/proxy/service?
      layers: osm
    coverage:
      bbox: [5.5, 47.4, 15.2, 54.8]
      bbox_srs: &#39;EPSG:4326&#39;
</pre></div>
</div>
<p>As you see notation of a coverage bounding box is similar to the notation in the
grid option.</p>
</div>
<div class="section" id="meta-tiles-and-meta-buffer">
<h3>Meta Tiles and Meta Buffer<a class="headerlink" href="#meta-tiles-and-meta-buffer" title="Permalink to this headline"></a></h3>
<p>When you have experience with WMS in tiled clients you should know the problem
of labeling issues. MapProxy can help to resolve these issues with two methods
called <a class="reference internal" href="labeling.html#meta-tiles"><span class="std std-ref">Meta Tiling</span></a> and <a class="reference internal" href="labeling.html#meta-buffer"><span class="std std-ref">Meta Buffering</span></a>.</p>
<p>There is a <a class="reference internal" href="labeling.html"><span class="doc">chapter on WMS labeling issues</span></a> that discusses these options.</p>
</div>
<div class="section" id="seeding">
<h3>Seeding<a class="headerlink" href="#seeding" title="Permalink to this headline"></a></h3>
<div class="section" id="configuration">
<h4>Configuration<a class="headerlink" href="#configuration" title="Permalink to this headline"></a></h4>
<p>MapProxy creates all tiles on demand. That means, only tiles requested once are
cached. Fortunately MapProxy comes with a command line script for pre-generating
all required tiles called <code class="docutils literal"><span class="pre">mapproxy-seed</span></code>. It has its own configuration file called
<code class="docutils literal"><span class="pre">seed.yaml</span></code> and a couple of options. We now create a config file for <code class="docutils literal"><span class="pre">mapproxy-seed</span></code>.</p>
<p>As all MapProxy configuration files it&#8217;s notated in YAML. The mandatory option
is <code class="docutils literal"><span class="pre">seeds</span></code>. Here you can create multiple seeding tasks that define what should be seeded.
You can specify a list of caches for seeding with <code class="docutils literal"><span class="pre">caches</span></code> . The cache names
should match the names in your MapProxy configuration. If you have specified
multiple grids for one cache in your MapProxy configuration, you can select these
caches to seed. They must also comply with the caches in your MapProxy configuration.
Furthermore you can limit the levels that should be seeded. If you want to seed only
a limited area, you can use the <code class="docutils literal"><span class="pre">coverages</span></code> option.</p>
<p>In the example below, we configure <code class="docutils literal"><span class="pre">mapproxy-seed</span></code> to seed our previously created
cache <code class="docutils literal"><span class="pre">test_wms_cache</span></code> from level 6 to level 16. To show a different possibility to
define a coverage, we use a polygon file to determine the area we want to seed.</p>
<div class="highlight-default"><div class="highlight"><pre><span></span><span class="n">seeds</span><span class="p">:</span>
  <span class="n">test_cache_seed</span><span class="p">:</span>
    <span class="n">caches</span><span class="p">:</span> <span class="p">[</span><span class="n">test_wms_cache</span><span class="p">]</span>
    <span class="n">levels</span><span class="p">:</span>
      <span class="n">from</span><span class="p">:</span> <span class="mi">6</span>
      <span class="n">to</span><span class="p">:</span> <span class="mi">16</span>
    <span class="n">coverages</span><span class="p">:</span> <span class="p">[</span><span class="n">germany</span><span class="p">]</span>

<span class="n">coverages</span><span class="p">:</span>
  <span class="n">germany</span><span class="p">:</span>
    <span class="n">polygons</span><span class="p">:</span> <span class="o">./</span><span class="n">GM</span><span class="o">.</span><span class="n">txt</span>
    <span class="n">polygons_srs</span><span class="p">:</span> <span class="n">EPSG</span><span class="p">:</span><span class="mi">900913</span>
</pre></div>
</div>
<p>As you see in the <code class="docutils literal"><span class="pre">coverages</span></code> section the <code class="docutils literal"><span class="pre">polygons</span></code> option point to a
text file. This text file contains polygons in Well-Known-Text (WKT) form. The third option tells
<code class="docutils literal"><span class="pre">mapproxy-seed</span></code> the <code class="docutils literal"><span class="pre">srs</span></code> of the WKT polygons.</p>
<p>You can <a class="reference download internal" href="_downloads/seed.yaml" download=""><code class="xref download docutils literal"><span class="pre">download</span> <span class="pre">the</span> <span class="pre">configuration</span></code></a> and the <a class="reference download internal" href="_downloads/GM.txt" download=""><code class="xref download docutils literal"><span class="pre">polygon</span> <span class="pre">file</span></code></a>.</p>
</div>
<div class="section" id="start-seeding">
<h4>Start Seeding<a class="headerlink" href="#start-seeding" title="Permalink to this headline"></a></h4>
<p>Now it&#8217;s time to start seeding. <code class="docutils literal"><span class="pre">mapproxy-seed</span></code> has a couple
of options. We have to use options <code class="docutils literal"><span class="pre">-s</span></code> to define our <code class="docutils literal"><span class="pre">seed.yaml</span></code> and <code class="docutils literal"><span class="pre">-f</span></code>
for our MapProxy configuration file. We also use the <code class="docutils literal"><span class="pre">--dry-run</span></code> option to see what
MapProxy would do, without making any actual requests to our sources. A mis-configured seeding
can take days or weeks, so you should keep an eye on the tile numbers the dry-run prints out.</p>
<p>Run <code class="docutils literal"><span class="pre">mapproxy-seed</span></code> like:</p>
<div class="highlight-default"><div class="highlight"><pre><span></span><span class="n">mapproxy</span><span class="o">-</span><span class="n">seed</span> <span class="o">-</span><span class="n">f</span> <span class="n">mapproxy</span><span class="o">.</span><span class="n">yaml</span> <span class="o">-</span><span class="n">s</span> <span class="n">seed</span><span class="o">.</span><span class="n">yaml</span> <span class="o">--</span><span class="n">dry</span><span class="o">-</span><span class="n">run</span>
</pre></div>
</div>
<p>If you sure, that seeding works right, remove <code class="docutils literal"><span class="pre">--dry-run</span></code>.</p>
</div>
</div>
<div class="section" id="what-s-next">
<h3>What&#8217;s next?<a class="headerlink" href="#what-s-next" title="Permalink to this headline"></a></h3>
<p>You should read the <a class="reference internal" href="configuration_examples.html"><span class="doc">configuration examples</span></a> to get a few
more ideas what MapProxy can do.</p>
<p>MapProxy has lots of small features that might be useful for your projects, so it is a good idea
to read the other chapters of the documentation after that.</p>
<p>If you have any questions? We have a <a class="reference external" href="http://mapproxy.org/support">mailing list and IRC channel</a>
where you can get support.</p>
</div>
</div>
</div>


    </div>
  </div>
</div>
<footer class="footer">
  <div class="container">
    <p class="pull-right">
      <a href="#">Back to top</a>
    </p>
    <p>
     
       &copy; Copyright Oliver Tonnhofer, Omniscale, <a href="http://mapproxy.org/about">Legal</a>
     
     <br/>
     
       Last updated on 2018-01-07
     <br/>

     
       Created using <a href="http://sphinx-doc.org/">Sphinx</a> 1.4.9.
     
   </p>
 </div>
</footer>
  </body>
</html>