-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathtemplate.html
More file actions
1161 lines (1115 loc) · 55.8 KB
/
template.html
File metadata and controls
1161 lines (1115 loc) · 55.8 KB
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
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
<!DOCTYPE html>
<html lang="en" data-content_root="../">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" /><meta name="viewport" content="width=device-width, initial-scale=1" />
<title>Templating — MapServer 8.6.2 documentation</title>
<link rel="stylesheet" type="text/css" href="../_static/pygments.css?v=03e43079" />
<link rel="stylesheet" type="text/css" href="../_static/sphinx.css?v=48f05237" />
<link rel="stylesheet" type="text/css" href="../_static/copybutton.css?v=76b2166b" />
<link rel="stylesheet" type="text/css" href="../_static/sphinx_collapse.css?v=226d88b4" />
<link rel="stylesheet" type="text/css" href="../_static/custom.css?v=dd298242" />
<link rel="stylesheet" type="text/css" href="../_static/ribbon.css?v=ea091bf4" />
<script src="../_static/jquery.js?v=5d32c60e"></script>
<script src="../_static/_sphinx_javascript_frameworks_compat.js?v=2cd50e6c"></script>
<script src="../_static/documentation_options.js?v=9a6d5eae"></script>
<script src="../_static/doctools.js?v=fd6eb6e6"></script>
<script src="../_static/sphinx_highlight.js?v=6ffebe34"></script>
<script src="../_static/clipboard.min.js?v=a7894cd8"></script>
<script src="../_static/copybutton.js?v=f281be69"></script>
<link rel="icon" href="../_static/mapserver.ico"/>
<link rel="author" title="About these documents" href="../about.html" />
<link rel="index" title="Index" href="../genindex.html" />
<link rel="search" title="Search" href="../search.html" />
<link rel="copyright" title="Copyright" href="../copyright.html" />
<link rel="next" title="VALIDATION" href="validation.html" />
<link rel="prev" title="Symbology Examples" href="symbology/examples.html" />
</head><body>
<!-- for main branch only, do not backport this -->
<table width="100%" style="width: 100%; background-color: white;">
<tr>
<td rowspan="2" style="padding: 10px 0px 10px 10px;">
<a href="../index.html" title="Home"><img src="../_static/banner.png" alt="MapServer banner" border="0" /></a>
</td>
<td style="padding: 10px 10px 0px 0px; text-align: right; vertical-align: top;">
<a href="../index.html" title="Home">Home</a> |
<a href="../products.html" title="Products (MapServer core, MapCache, TinyOWS">Products</a> |
<a href="https://github.com/mapserver/mapserver/issues/" title="Issue Tracker (MapServer core)">Issue Tracker</a> |
<a href="../community/service_providers.html" title="Professional Service Providers">Service Providers</a> |
<a href="../faq.html" title="Frequently Asked Questions">FAQ</a> |
<a href="https://fosstodon.org/@mapserver" title="Mastodon" target="_blank">Mastodon</a> |
<a href="../download.html" title="Download Source or Binaries">Download </a> |
<a class="badge" href="https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=KRJ2X44N3HA6U&source=url" target="_blank">
<img src="https://img.shields.io/badge/donate-%E2%9D%A4%C2%A0-ff69b4.svg?style=flat" alt="Donate to MapServer">
</a>
</td>
</tr>
<tr>
<td style="padding: 0px 10px 0px 0px; text-align: right; vertical-align: bottom;">
<img src="../_static/flagicons/en.png" alt="en" title="en" border="0" width="18px" height="13px"/>
<a href="../ar/mapfile/template.html"><img src="../_static/flagicons/ar.png" alt="ar" title="ar" border="0" /></a>
<a href="../de/mapfile/template.html"><img src="../_static/flagicons/de.png" alt="de" title="de" border="0" /></a>
<a href="../el/mapfile/template.html"><img src="../_static/flagicons/el.png" alt="el" title="el" border="0" /></a>
<a href="../es/mapfile/template.html"><img src="../_static/flagicons/es.png" alt="es" title="es" border="0" /></a>
<a href="../fr/mapfile/template.html"><img src="../_static/flagicons/fr.png" alt="fr" title="fr" border="0" /></a>
<a href="../id/mapfile/template.html"><img src="../_static/flagicons/id.png" alt="id" title="id" border="0" /></a>
<a href="../it/mapfile/template.html"><img src="../_static/flagicons/it.png" alt="it" title="it" border="0" /></a>
<a href="../ja/mapfile/template.html"><img src="../_static/flagicons/ja.png" alt="ja" title="ja" border="0" /></a>
<a href="../nl_NL/mapfile/template.html"><img src="../_static/flagicons/nl_NL.png" alt="nl_NL" title="nl_NL" border="0" /></a>
<a href="../pl/mapfile/template.html"><img src="../_static/flagicons/pl.png" alt="pl" title="pl" border="0" /></a>
<a href="../ru/mapfile/template.html"><img src="../_static/flagicons/ru.png" alt="ru" title="ru" border="0" /></a>
<a href="../sq/mapfile/template.html"><img src="../_static/flagicons/sq.png" alt="sq" title="sq" border="0" /></a>
<a href="../tr/mapfile/template.html"><img src="../_static/flagicons/tr.png" alt="tr" title="tr" border="0" /></a>
</td>
</tr>
</table>
<div class="related" role="navigation" aria-label="Related">
<h3>Navigation</h3>
<ul>
<li class="right" style="margin-right: 10px">
<a href="../genindex.html" title="General Index"
accesskey="I">index</a></li>
<li class="right" >
<a href="validation.html" title="VALIDATION"
accesskey="N">next</a> |</li>
<li class="right" >
<a href="symbology/examples.html" title="Symbology Examples"
accesskey="P">previous</a> |</li>
<li class="nav-item nav-item-0"><a href="../index.html">Home</a> »</li>
<li class="nav-item nav-item-1"><a href="../documentation.html" >MapServer 8.6.2 Documentation</a> »</li>
<li class="nav-item nav-item-2"><a href="index.html" accesskey="U">Mapfile</a> »</li>
<li class="nav-item nav-item-this"><a href="">Templating</a></li>
</ul>
</div>
<div class="document">
<div class="documentwrapper">
<div class="bodywrapper">
<div class="body" role="main">
<section id="templating">
<span id="template"></span><span id="index-0"></span><h1><a class="toc-backref" href="#table-of-contents" role="doc-backlink">Templating</a><a class="headerlink" href="#templating" title="Link to this heading">¶</a></h1>
<dl class="field-list simple">
<dt class="field-odd">Author<span class="colon">:</span></dt>
<dd class="field-odd"><p>Frank Koormann</p>
</dd>
<dt class="field-even">Contact<span class="colon">:</span></dt>
<dd class="field-even"><p>frank.koormann at intevation.de</p>
</dd>
<dt class="field-odd">Author<span class="colon">:</span></dt>
<dd class="field-odd"><p>Jeff McKenna</p>
</dd>
<dt class="field-even">Contact<span class="colon">:</span></dt>
<dd class="field-even"><p>jmckenna at gatewaygeomatics.com</p>
</dd>
<dt class="field-odd">Last Updated<span class="colon">:</span></dt>
<dd class="field-odd"><p>2026-03-29</p>
</dd>
</dl>
<nav class="contents" id="table-of-contents">
<p class="topic-title">Table of Contents</p>
<ul class="simple">
<li><p><a class="reference internal" href="#templating" id="id1">Templating</a></p>
<ul>
<li><p><a class="reference internal" href="#introduction" id="id2">Introduction</a></p></li>
<li><p><a class="reference internal" href="#format" id="id3">Format</a></p></li>
<li><p><a class="reference internal" href="#example-template" id="id4">Example Template</a></p></li>
</ul>
</li>
</ul>
</nav>
<section id="introduction">
<h2><a class="toc-backref" href="#table-of-contents" role="doc-backlink">Introduction</a><a class="headerlink" href="#introduction" title="Link to this heading">¶</a></h2>
<p>Templates are used:</p>
<ul class="simple">
<li><p>to define the look of a MapServer CGI application interface</p></li>
<li><p>to present the results of a query.</p></li>
<li><p>to create customised output (see <a class="reference internal" href="../output/template_output.html#template-output"><span class="std std-ref">Template-Driven Output</span></a>)</p></li>
</ul>
<p>They guide the presentation of results, either a query or a map, to
the user. Templates are almost always HTML files although they can
also be a URL (e.g..
<a class="reference external" href="http://www.somewhere.com/[ATTRIBUTE]/info.html">http://www.somewhere.com/[ATTRIBUTE]/info.html</a>). URL templates can
only be used with simple QUERY or ITEMQUERY results so many
substitutions defined below are not available for them. Simple
pan/zoom interfaces use a single template file while complicated
queries often require many templates. Templates often use JavaScript
to enhance the basic interface.</p>
<section id="notes">
<h3>Notes<a class="headerlink" href="#notes" title="Link to this heading">¶</a></h3>
<ul>
<li><p>Templates <em>must</em> contain the magic string ‘mapserver template’ in
the first line of the template. Often this takes the form of an
HTML, javascript or XML comment. This line is <em>not</em> written to the
client. The magic string is not case sensitive.</p></li>
<li><p>MapServer will only accept certain file extensions for templates;
valid file extensions are:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="o">.</span><span class="n">gml</span>
<span class="o">.</span><span class="n">html</span>
<span class="o">.</span><span class="n">htm</span>
<span class="o">.</span><span class="n">js</span>
<span class="o">.</span><span class="n">kml</span>
<span class="o">.</span><span class="n">svg</span>
<span class="o">.</span><span class="n">tmpl</span>
<span class="o">.</span><span class="n">wml</span>
<span class="o">.</span><span class="n">xml</span>
</pre></div>
</div>
</li>
<li><p>All <a class="reference internal" href="../cgi/index.html#cgi"><span class="std std-ref">CGI parameters</span></a> can be referenced in template
substitutions, MapServer specific parameters as well as user defined
ones. In principle parameters are handed through by the MapServer
1:1. This feature is essential for implementing MapServer
applications.</p>
<p>The reference below only lists special template substitution strings
which are needed to obtain information modified by the MapServer,
e.g. a new scale, query results, etc.</p>
</li>
<li><p>Template substitution strings are case sensitive.</p></li>
<li><p>Attribute item substitutions must be the same case as the item names
in the dbase file.</p></li>
<li><p>ArcView and ArcInfo generally produce dbase files with item names
that are all uppercase. Appropriate URL encoding (i.e. ‘ ‘ to ‘+’)
is applied when templates are URLs.</p></li>
<li><p>Some substitutions are also available in escaped form (i.e. URL
encoded).</p></li>
</ul>
<p>As an example this is needed when generating links within a
template. This might pass the current mapextent to a new MapServer
call. <em>[mapext]</em> is substituted by a space delimited set of lower left
and upper right coordinates. This would break the URL. <em>[mapext_esc]</em>
is substituted by a proper encoded set.</p>
</section>
</section>
<section id="format">
<h2><a class="toc-backref" href="#table-of-contents" role="doc-backlink">Format</a><a class="headerlink" href="#format" title="Link to this heading">¶</a></h2>
<p>Templates are simply HTML files or URL strings that contains special
characters that are replaced by <a class="reference internal" href="../cgi/mapserv.html#mapserv"><span class="std std-ref">mapserv</span></a> each time the template
is processed. The simple substitution allows information such as
active layers or the spatial extent to be passed from the user to
<a class="reference internal" href="../cgi/mapserv.html#mapserv"><span class="std std-ref">mapserv</span></a> and back again. Most often the new values are dumped
into form variables that will be passed on again. The list of special
characters and form variables is given below. HTML templates can
include just about anything including JavaScript and Java calls.</p>
<p>In HTML files, the attribute values can be inside quotes(“”). Writing
attribute values inside quotes allows you to set special characters in
value that you couldn’t use normally (ie: ],=,” and space). To write a
single quote in a attribute value, just use two quotes (“”).</p>
<section id="general">
<h3>General<a class="headerlink" href="#general" title="Link to this heading">¶</a></h3>
<dl>
<dt>[date]</dt><dd><p>Outputs the date (as per the web server’s clock). The default
format is the same as is used by Apache’s Common Log format,
which looks like:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="mi">01</span><span class="o">/</span><span class="n">Dec</span><span class="o">/</span><span class="mi">2010</span><span class="p">:</span><span class="mi">17</span><span class="p">:</span><span class="mi">34</span><span class="p">:</span><span class="mi">58</span> <span class="o">-</span><span class="mi">0800</span>
</pre></div>
</div>
<p>Available arguments:</p>
<ul>
<li><dl>
<dt>format=</dt><dd><p>A format string as supported by the standard C strftime()
function. As an example, the default format is defined as:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="p">[</span><span class="n">date</span> <span class="nb">format</span><span class="o">=</span><span class="s2">"</span><span class="si">%d</span><span class="s2">/%b/%Y:%H:%M:%S %z"</span><span class="p">]</span>
</pre></div>
</div>
</dd>
</dl>
</li>
<li><dl>
<dt>tz=</dt><dd><p>timezone to use for the date returned. Default is
“local”. Valid values are:</p>
<ul class="simple">
<li><dl class="simple">
<dt>“gmt”</dt><dd><p>Output date will be Greenwich time</p>
</dd>
</dl>
</li>
<li><dl class="simple">
<dt>“local”</dt><dd><p>Output the time in the web server’s local time zone.</p>
</dd>
</dl>
</li>
</ul>
<p>Additionally or alternatively, the %z and %Z strftime format
strings allow the timezone offset or name to be output.</p>
</dd>
</dl>
</li>
</ul>
</dd>
<dt>[version]</dt><dd><p>The MapServer version number.</p>
</dd>
<dt>[id]</dt><dd><p>Unique session id. The id can be passed in via a form but is more
commonly generated by the software. In that case the id is a
concatenation of UNIX time (or NT equivalent) and the process
id. Unless you’re getting more requests in a second than the
system has process ids the id can be considered unique. ;-></p>
</dd>
<dt>[host]</dt><dd><p>Hostname of the web server.</p>
</dd>
<dt>[port]</dt><dd><p>Port the web server is listening to.</p>
</dd>
<dt>[post or get variable name], [post or get variable name_esc]</dt><dd><p>The contents of any variables passed to the MapServer, whether
they were used or not, can be echoed this way. One use might be
to have the user set a map title or north arrow style in an
interactive map composer. The system doesn’t care about the
values, but they might be real important in creating the final
output, e.g. if you specified a CGI parameter like myvalue=….
you can access this in the template file with [myvalue].</p>
<p>Also available as escaped version.</p>
</dd>
<dt>[web_meta data key],[web_meta data key_esc]</dt><dd><p>Web object meta data access (e.g [web_projection]</p>
<p>Also available as escaped version.</p>
</dd>
<dt>[errmsg], [errmsg_esc]</dt><dd><p>Current error stack output. Various error messages are delimited
by semi-colons.</p>
<p>Also available as escaped version.</p>
</dd>
</dl>
</section>
<section id="file-reference">
<h3>File Reference<a class="headerlink" href="#file-reference" title="Link to this heading">¶</a></h3>
<dl>
<dt>[img]</dt><dd><p>Path (relative to document root) of the new image, just the image
name if IMAGEURL is not set in the mapfile.</p>
<p>In a map interface template, [img] is substituted with the path
to the map image. In a query results template, it is substituted
with the path to the querymap image (if a <a class="reference internal" href="querymap.html#querymap"><span class="std std-ref">QUERYMAP</span></a> object
is defined in the <a class="reference internal" href="index.html#mapfile"><span class="std std-ref">Mapfile</span></a>).</p>
</dd>
<dt>[ref]</dt><dd><p>Path (relative to document root) of the new reference image.</p>
</dd>
<dt>[legend]</dt><dd><p>Path (relative to document root) of new legend image rendered by
the MapServer.</p>
<p>Since version 3.5.1 a new HTML Legend template is provided by
MapServer. If a template is defined in the <a class="reference internal" href="index.html#mapfile"><span class="std std-ref">Mapfile</span></a> the
[legend] string is replaced by the processed legend as. See the
<a class="reference internal" href="../output/html_legend.html#html-legend"><span class="std std-ref">HTML Legends with MapServer</span></a> for details.</p>
</dd>
<dt>[scalebar]</dt><dd><p>Path (relative to document root) of new scalebar image.</p>
</dd>
<dt>[queryfile]</dt><dd><p>Path to the query file (if savequery was set as a <a class="reference internal" href="../cgi/index.html#cgi"><span class="std std-ref">CGI
Parameter</span></a>).</p>
</dd>
<dt>[map]</dt><dd><p>Path to the map file (if savemap was set as a <a class="reference internal" href="../cgi/index.html#cgi"><span class="std std-ref">CGI Parameter</span></a>).</p>
</dd>
</dl>
</section>
<section id="image-geometry">
<h3>Image Geometry<a class="headerlink" href="#image-geometry" title="Link to this heading">¶</a></h3>
<dl>
<dt>[center]</dt><dd><p>Computed image center in pixels. Useful for setting imgxy form
variable when map sizes change.</p>
</dd>
<dt>[center_x], [center_y]</dt><dd><p>Computed image center X or Y coordinate in pixels.</p>
</dd>
<dt>[mapsize], [mapsize_esc]</dt><dd><p>Current image size in cols and rows (separated by spaces).</p>
<p>Also available as escaped version.</p>
</dd>
<dt>[mapwidth], [mapheight]</dt><dd><p>Current image width or height.</p>
</dd>
<dt>[scaledenom]</dt><dd><p>Current image scale. The exact value is not appropriate for user
information but essential for some applications. The value can be
rounded e.g. using JavaScript or server side post processing.</p>
</dd>
<dt>[scale] - deprecated</dt><dd><p>Since MapServer 5.0 the proper parameter to use is [scaledenom]
instead. The deprecated [scale] is the current image scale. The
exact value is not appropriate for user information but essential
for some applications. The value can be rounded e.g. using
JavaScript or server side post processing.</p>
</dd>
<dt>[cellsize]</dt><dd><p>Size of an pixel in the current image in map units. Useful for
distance measurement tools in user interfaces.</p>
</dd>
</dl>
</section>
<section id="map-geometry">
<h3>Map Geometry<a class="headerlink" href="#map-geometry" title="Link to this heading">¶</a></h3>
<dl>
<dt>[mapx], [mapy]</dt><dd><p>X and Y coordinate of mouse click.</p>
</dd>
<dt>[mapext], [mapext_esc]</dt><dd><p>Full mapextent (separated by spaces).</p>
<p>Also available as escaped version. (mapext_esc is deprecated in
MapServer 5.2. You should use the “escape=” argument instead)</p>
<p>The default template [mapext] returns coordinates in the format
of: mixx miny maxx maxy</p>
<p>Available arguments:</p>
<ul>
<li><dl class="simple">
<dt>escape=</dt><dd><p>Escape the coordinates returned. Default is “none”.
Valid values are:</p>
<ul class="simple">
<li><dl class="simple">
<dt>“url”</dt><dd><p>Use URL escape codes to encode the coordinates returned.</p>
</dd>
</dl>
</li>
<li><dl class="simple">
<dt>“none”</dt><dd><p>Do not escape.</p>
</dd>
</dl>
</li>
</ul>
</dd>
</dl>
</li>
<li><dl>
<dt>expand=</dt><dd><p>Expand the bounds of the extents by a specific value.
Specified in map coordinates. For example, [mapext]
might return:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="mi">123456</span> <span class="mi">123456</span> <span class="mi">567890</span> <span class="mi">567890</span>
</pre></div>
</div>
<p>and [mapext expand=1000] would therefore return:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="mi">122456</span> <span class="mi">122456</span> <span class="mi">568890</span> <span class="mi">568890</span>
</pre></div>
</div>
</dd>
</dl>
</li>
<li><dl>
<dt>format=</dt><dd><p>Format of the coordinates. Default is “$minx $miny $maxx
$maxy”. For example, to add commas to the coordinates
you would use:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="p">[</span><span class="n">mapext</span> <span class="nb">format</span><span class="o">=</span><span class="s2">"$minx,$miny,$maxx,$maxy"</span><span class="p">]</span>
</pre></div>
</div>
</dd>
</dl>
</li>
<li><dl class="simple">
<dt>precision=</dt><dd><p>The number of decimal places to output for coordinates
(default is 0).</p>
</dd>
</dl>
</li>
</ul>
</dd>
<dt>[minx], [miny], [maxx], [maxy]</dt><dd><p>Minimum / maximum X or Y coordinate of new map extent.</p>
</dd>
<dt>[dx], [dy]</dt><dd><p>The differences of minimum / maximum X or Y coordinate of new map
extent.</p>
<p>Useful for creating cachable extents (i.e. 0 0 dx dy) with
legends and scalebars</p>
</dd>
<dt>[rawext], [rawext_esc]</dt><dd><p>Raw mapextent, that is the extent before fitting to a window size
(separated by spaces). In cases where input came from imgbox (via
Java or whatever) rawext refers to imgbox coordinates transformed
to map units. Useful for spatial query building.</p>
<p>Also available as escaped version. (rawext_esc is deprecated in
MapServer 5.2. You should use the “escape=” argument instead)</p>
<p>The default template [rawext] returns coordinates in the format
of: mixx miny maxx maxy</p>
<p>Available arguments:</p>
<ul>
<li><dl class="simple">
<dt>escape=</dt><dd><p>Escape the coordinates returned. Default is “none”.
Valid values are:</p>
<ul class="simple">
<li><dl class="simple">
<dt>“url”</dt><dd><p>Use URL escape codes to encode the coordinates
returned.</p>
</dd>
</dl>
</li>
<li><dl class="simple">
<dt>“none”</dt><dd><p>Do not escape.</p>
</dd>
</dl>
</li>
</ul>
</dd>
</dl>
</li>
<li><dl>
<dt>expand=</dt><dd><p>Expand the bounds of the extents by a specific value.
Specified in map coordinates. For example, [rawext]
might return:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="mi">123456</span> <span class="mi">123456</span> <span class="mi">567890</span> <span class="mi">567890</span>
</pre></div>
</div>
<p>and [rawext expand=1000] would therefore return:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="mi">122456</span> <span class="mi">122456</span> <span class="mi">568890</span> <span class="mi">568890</span>
</pre></div>
</div>
</dd>
</dl>
</li>
<li><dl>
<dt>format=</dt><dd><p>Format of the coordinates. Default is “$minx $miny $maxx
$maxy”. For example, to add commas to the coordinates
you would use:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="p">[</span><span class="n">rawext</span> <span class="nb">format</span><span class="o">=</span><span class="s2">"$minx,$miny,$maxx,$maxy"</span><span class="p">]</span>
</pre></div>
</div>
</dd>
</dl>
</li>
<li><dl class="simple">
<dt>precision=</dt><dd><p>The number of decimal places to output for coordinates
(default is 0).</p>
</dd>
</dl>
</li>
</ul>
</dd>
<dt>[rawminx], [rawminy], [rawmaxx], [rawmaxy]</dt><dd><p>Minimum / maximum X or Y coordinate of a raw map/search extent.</p>
</dd>
</dl>
<p>The following substitutions are only available if the MapServer was
compiled with PROJ support and a <a class="reference internal" href="projection.html#projection"><span class="std std-ref">PROJECTION</span></a> is defined in the
<a class="reference internal" href="index.html#mapfile"><span class="std std-ref">Mapfile</span></a>.</p>
<dl>
<dt>[maplon], [maplat]</dt><dd><p>Longitude / latitude value of mouse click. Available only when
projection enabled.</p>
</dd>
<dt>[mapext_latlon], [mapext_latlon_esc]</dt><dd><p>Full mapextent (separated by spaces). Available only when
projection enabled.</p>
<p>Also available as escaped version. (mapext_latlon_esc is
deprecated in MapServer 5.2. You should use the “escape=”
argument instead)</p>
<p>The default template [mapext_latlon] returns coordinates in the
format of: mixx miny maxx maxy</p>
<p>Available arguments:</p>
<ul>
<li><dl class="simple">
<dt>escape=</dt><dd><p>Escape the coordinates returned. Default is “none”.
Valid values are:</p>
<ul class="simple">
<li><dl class="simple">
<dt>“url”</dt><dd><p>Use URL escape codes to encode the coordinates
returned.</p>
</dd>
</dl>
</li>
<li><dl class="simple">
<dt>“none”</dt><dd><p>Do not escape.</p>
</dd>
</dl>
</li>
</ul>
</dd>
</dl>
</li>
<li><dl>
<dt>expand=</dt><dd><p>Expand the bounds of the extents by a specific value.
Specified in map coordinates. For example,
[mapext_latlon] might return:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="mi">123456</span> <span class="mi">123456</span> <span class="mi">567890</span> <span class="mi">567890</span>
</pre></div>
</div>
<p>and [mapext_latlon expand=1000] would therefore return:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="mi">122456</span> <span class="mi">122456</span> <span class="mi">568890</span> <span class="mi">568890</span>
</pre></div>
</div>
</dd>
</dl>
</li>
<li><dl>
<dt>format=</dt><dd><p>Format of the coordinates. Default is “$minx $miny $maxx
$maxy”. For example, to add commas to the coordinates
you would use:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="p">[</span><span class="n">mapext_latlon</span> <span class="nb">format</span><span class="o">=</span><span class="s2">"$minx,$miny,$maxx,$maxy"</span><span class="p">]</span>
</pre></div>
</div>
</dd>
</dl>
</li>
<li><dl class="simple">
<dt>precision=</dt><dd><p>The number of decimal places to output for coordinates
(default is 0).</p>
</dd>
</dl>
</li>
</ul>
</dd>
<dt>[minlon], [minlat], [maxlon] [maxlat]</dt><dd><p>Minimum / maximum longitude or latitude value of
mapextent. Available only when projection enabled.</p>
</dd>
<dt>[refext], [refext_esc]</dt><dd><p>Reference map extent (separated by spaces).</p>
<p>This template has been added with version 4.6 on behalf of an
enhancement request. See the thread in the <a class="reference external" href="https://github.com/MapServer/MapServer/issues/1102">MapServer
ticket#1102</a> for potential use cases.</p>
<p>Also available as escaped version. (refext_esc is deprecated in
MapServer 5.2. You should use the “escape=” argument instead)</p>
<p>The default template [refext] returns coordinates in the format
of: mixx miny maxx maxy</p>
<p>Available arguments:</p>
<ul>
<li><dl class="simple">
<dt>escape=</dt><dd><p>Escape the coordinates returned. Default is “none”.
Valid values are:</p>
<ul class="simple">
<li><dl class="simple">
<dt>“url”</dt><dd><p>Use URL escape codes to encode the coordinates
returned.</p>
</dd>
</dl>
</li>
<li><dl class="simple">
<dt>“none”</dt><dd><p>Do not escape.</p>
</dd>
</dl>
</li>
</ul>
</dd>
</dl>
</li>
<li><dl>
<dt>expand=</dt><dd><p>Expand the bounds of the extents by a specific value.
Specified in map coordinates. For example, [refext]
might return:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="mi">123456</span> <span class="mi">123456</span> <span class="mi">567890</span> <span class="mi">567890</span>
</pre></div>
</div>
<p>and [refext expand=1000] would therefore return:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="mi">122456</span> <span class="mi">122456</span> <span class="mi">568890</span> <span class="mi">568890</span>
</pre></div>
</div>
</dd>
</dl>
</li>
<li><dl>
<dt>format=</dt><dd><p>Format of the coordinates. Default is “$minx $miny $maxx
$maxy”. For example, to add commas to the coordinates
you would use:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="p">[</span><span class="n">refwext</span> <span class="nb">format</span><span class="o">=</span><span class="s2">"$minx,$miny,$maxx,$maxy"</span><span class="p">]</span>
</pre></div>
</div>
</dd>
</dl>
</li>
<li><dl class="simple">
<dt>precision=</dt><dd><p>The number of decimal places to output for coordinates
(default is 0).</p>
</dd>
</dl>
</li>
</ul>
</dd>
</dl>
</section>
<section id="layer">
<h3>Layer<a class="headerlink" href="#layer" title="Link to this heading">¶</a></h3>
<dl>
<dt>[layers] | [layers_esc]</dt><dd><p>All active layers space delimited. Used for a “POST” request.</p>
<p>Also available as escaped version.</p>
</dd>
<dt>[toggle_layers] | [toggle_layers_esc]</dt><dd><p>List of all layers that can be toggled, i.e. all layers defined
in the <a class="reference internal" href="index.html#mapfile"><span class="std std-ref">Mapfile</span></a> which status is currently not default.</p>
<p>Also available as escaped version.</p>
</dd>
<dt>[layername_check | select]</dt><dd><p>Used for making layers persistent across a map creation
session. String is replaced with the keyword “checked”,
“selected” or “” if layername is on. Layername is the name of a
layer as it appears in the <a class="reference internal" href="index.html#mapfile"><span class="std std-ref">Mapfile</span></a>. Does not work for
default layers.</p>
</dd>
<dt>[layername_meta data key]</dt><dd><p>Layer meta data access (e.g. [streets_build] the underscore is
essential).</p>
</dd>
</dl>
</section>
<section id="zoom">
<h3>Zoom<a class="headerlink" href="#zoom" title="Link to this heading">¶</a></h3>
<dl>
<dt>[zoom_minzoom to maxzoom_check|select]</dt><dd><p>Used for making the zoom factor persistent. Zoom values can range
from -25 to 25 by default. The string is replaced with the HTML
keyword “checked”, “selected” or “” depending on the current zoom
value.</p>
<p>E.g. if the zoom is 12, a [zoom_12_select] is replaced with
“selected”, while a [zoom_13_select] in the same HTML template
file is not.</p>
</dd>
<dt>[zoomdir_-1|0|1_check|select]</dt><dd><p>Used for making the zoom direction persistent. Use check with a
radio control or select with a selection list. See the demo for
an example. The string is replaced with the HTML keyword
“checked”, “selected” or “” depending on the current value of
zoomdir.</p>
</dd>
</dl>
</section>
<section id="query">
<h3>Query<a class="headerlink" href="#query" title="Link to this heading">¶</a></h3>
<p>The following substitutions are only available when the template is
processed as a result of a query.</p>
<dl>
<dt>[shpext], [shpext_esc]</dt><dd><p>Extent of current shape plus a 5 percent buffer. Available only
when processing query results.</p>
<p>The default template [shpext] returns coordinates in the format
of: mixx miny maxx maxy</p>
<p>Available arguments:</p>
<ul>
<li><dl>
<dt>escape=</dt><dd><p>Escape the coordinates returned. Default is “none”.
Valid values are:</p>
<ul>
<li><p>“url”</p>
<blockquote>
<div><p>Use URL escape codes to encode the coordinates
returned.</p>
</div></blockquote>
</li>
<li><dl class="simple">
<dt>“none”</dt><dd><p>Do not escape.</p>
</dd>
</dl>
</li>
</ul>
</dd>
</dl>
</li>
<li><dl>
<dt>expand=</dt><dd><p>Expand the bounds of the extents by a specific value.
Specified in map coordinates. For example, [shpext]
might return:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="mi">123456</span> <span class="mi">123456</span> <span class="mi">567890</span> <span class="mi">567890</span>
</pre></div>
</div>
<p>and [shpext expand=1000] would therefore return:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="mi">122456</span> <span class="mi">122456</span> <span class="mi">568890</span> <span class="mi">568890</span>
</pre></div>
</div>
</dd>
</dl>
</li>
<li><dl>
<dt>format=</dt><dd><p>Format of the coordinates. Default is “$minx $miny $maxx
$maxy”. For example, to add commas to the coordinates
you would use:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="p">[</span><span class="n">shpext</span> <span class="nb">format</span><span class="o">=</span><span class="s2">"$minx,$miny,$maxx,$maxy"</span><span class="p">]</span>
</pre></div>
</div>
</dd>
</dl>
</li>
<li><dl class="simple">
<dt>precision=</dt><dd><p>The number of decimal places to output for coordinates
(default is 0).</p>
</dd>
</dl>
</li>
</ul>
</dd>
<dt>[shpminx], [shpminy], [shpmaxx], [shpmaxy]</dt><dd><p>Minimum / maximum X or Y coordinate of shape extent. Available
only when processing query results.</p>
</dd>
<dt>[shpmid]</dt><dd><p>Middle of the extent of current shape. Available only when
processing query results.</p>
</dd>
<dt>[shpmidx], [shpmidy]</dt><dd><p>X or Y coordinate of middle of the extent of the current
shape. Available only when processing query results.</p>
</dd>
<dt>[shpidx]</dt><dd><p>Index value of the current shape. Available only when processing
query results.</p>
</dd>
<dt>[shpclass]</dt><dd><p>Classindex value of the current shape. Available only when
processing query results.</p>
</dd>
<dt>[shpxy formatting options]</dt><dd><p>The list of shape coordinates, with list formatting options,
especially useful for SVG.</p>
<p>The default template [shpxy] returns a comma separated list of
space delimited of coordinates (i.e. x1 y1, x2 y2, x3 y3).</p>
<p>Available only when processing query results.</p>
<p>Available attributes (h = header, f=footer, s=separator):</p>
<ul>
<li><dl class="simple">
<dt>buffer=,</dt><dd><p>Buffer size, currently the only unit available is pixels.
Default is 0.</p>
</dd>
</dl>
</li>
<li><dl class="simple">
<dt>centroid=</dt><dd><p>Should only the centroid of the shape be used?
true or false (case insensitive). Default is false.</p>
</dd>
</dl>
</li>
<li><dl class="simple">
<dt>cs=</dt><dd><p>Coordinate separator. Default is “,”.</p>
</dd>
</dl>
</li>
<li><p>irh=, irf=, orh=, orf=</p>
<blockquote>
<div><p>Characters to be put before (<cite>irh</cite>) and after (<cite>irf</cite>)
inner rings, and before (<cite>orh</cite>) and after (<cite>orf</cite>) outer
rings of polygons with holes. Defaults are “”.</p>
<div class="admonition note">
<p class="admonition-title">Note</p>
<p>Within each polygon, the outer ring is always output
first, followed by the inner rings.</p>
</div>
<p>If neither <cite>irh</cite> nor <cite>orh</cite> are set, rings are output as
“parts” using <cite>ph</cite>/<cite>pf</cite>/<cite>ps</cite>.</p>
</div></blockquote>
</li>
<li><dl class="simple">
<dt>ph=, pf=, ps=</dt><dd><p>Characters to put before (<cite>ph</cite>) and after (<cite>pf</cite>) and
separators between (<cite>ps</cite>) feature parts (e.g. rings of
multigeometries). Defaults are ph=””, pf=”” and ps=” “.</p>
</dd>
</dl>
</li>
<li><dl class="simple">
<dt>precision=</dt><dd><p>The number of decimal places to output for coordinates.
Default is 0.</p>
</dd>
</dl>
</li>
<li><dl class="simple">
<dt>proj=</dt><dd><p>The output projection definition for the coordinates, a
special value of “image” will convert to image
coordinates. Default is none.</p>
</dd>
</dl>
</li>
<li><dl class="simple">
<dt>scale=, scale_x=, scale_y=</dt><dd><p>Scaling factor for coordinates: Both axes (<cite>scale</cite>), x
axis (<cite>scale_x</cite>) and y axis (<cite>scale_y</cite>). Defaults are
1.0.</p>
</dd>
</dl>
</li>
<li><dl class="simple">
<dt>sh=, sf=</dt><dd><p>Characters to put before (<cite>sh</cite>) and after (<cite>sf</cite>) a
feature. Defaults are “”.</p>
</dd>
</dl>
</li>
<li><dl class="simple">
<dt>xh=, xf=</dt><dd><p>Characters to put before (<cite>xh</cite>) and after (<cite>xf</cite>) the x
coordinates. Defaults are xh=”” and xf=”,”).</p>
</dd>
</dl>
</li>
<li><dl class="simple">
<dt>yh= yf=</dt><dd><p>Characters to put before (<cite>yh</cite>) and after (<cite>yf</cite>) the y
coordinates. Defaults are “”.</p>
</dd>
</dl>
</li>
</ul>
<p>As a simple example:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="p">[</span><span class="n">shpxy</span> <span class="n">xh</span><span class="o">=</span><span class="s2">"("</span> <span class="n">yf</span><span class="o">=</span><span class="s2">")"</span><span class="p">]</span> <span class="n">will</span> <span class="n">result</span> <span class="ow">in</span><span class="p">:</span> <span class="p">(</span><span class="n">x1</span> <span class="n">y1</span><span class="p">),(</span><span class="n">x2</span> <span class="n">y2</span><span class="p">),(</span><span class="n">x3</span> <span class="n">y3</span><span class="p">)</span>
<span class="ow">or</span>
<span class="p">[</span><span class="n">shpxy</span> <span class="n">precision</span><span class="o">=</span><span class="s2">"2"</span> <span class="n">xh</span><span class="o">=</span><span class="s2">"("</span> <span class="n">yf</span><span class="o">=</span><span class="s2">")"</span><span class="p">]</span> <span class="n">will</span> <span class="n">result</span> <span class="ow">in</span><span class="p">:</span> <span class="p">(</span><span class="n">x1</span><span class="p">,</span><span class="n">y1</span><span class="p">)</span> <span class="p">(</span><span class="n">x2</span><span class="p">,</span><span class="n">y2</span><span class="p">)</span> <span class="p">(</span><span class="n">x3</span><span class="p">,</span><span class="n">y3</span><span class="p">)</span>
<span class="ow">or</span>
<span class="p">[</span><span class="n">shpxy</span> <span class="n">precision</span><span class="o">=</span><span class="s2">"2"</span> <span class="n">xf</span><span class="o">=</span><span class="s2">" "</span> <span class="n">xh</span><span class="o">=</span><span class="s2">"("</span> <span class="n">yf</span><span class="o">=</span><span class="s2">")"</span><span class="p">]</span> <span class="n">will</span> <span class="n">result</span> <span class="ow">in</span><span class="p">:</span> <span class="p">(</span><span class="n">x1</span> <span class="n">y1</span><span class="p">)</span> <span class="p">(</span><span class="n">x2</span> <span class="n">y2</span><span class="p">)</span> <span class="p">(</span><span class="n">x3</span> <span class="n">y3</span><span class="p">)</span>
</pre></div>
</div>
<p>And a more complicated example of outputting KML for
multipolygons which may potentially have holes (note that the
parameters must all be on one line):</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="o"><</span><span class="n">MultiGeometry</span><span class="o">></span>
<span class="o"><</span><span class="n">Point</span><span class="o">></span>
<span class="o"><</span><span class="n">coordinates</span><span class="o">></span><span class="p">[</span><span class="n">shplabel</span> <span class="n">proj</span><span class="o">=</span><span class="n">epsg</span><span class="p">:</span><span class="mi">4326</span> <span class="n">precision</span><span class="o">=</span><span class="mi">10</span><span class="p">],</span><span class="mi">0</span><span class="o"></</span><span class="n">coordinates</span><span class="o">></span>
<span class="o"></</span><span class="n">Point</span><span class="o">></span>
<span class="p">[</span><span class="n">shpxy</span> <span class="n">ph</span><span class="o">=</span><span class="s2">"<Polygon><tessellate>1</tessellate>"</span> <span class="n">pf</span><span class="o">=</span><span class="s2">"</Polygon>"</span> <span class="n">xf</span><span class="o">=</span><span class="s2">","</span>
<span class="n">xh</span><span class="o">=</span><span class="s2">" "</span> <span class="n">yh</span><span class="o">=</span><span class="s2">" "</span> <span class="n">yf</span><span class="o">=</span><span class="s2">",0 "</span> <span class="n">orh</span><span class="o">=</span><span class="s2">"<outerBoundaryIs><LinearRing><coordinates>"</span>
<span class="n">orf</span><span class="o">=</span><span class="s2">"</coordinates></LinearRing></outerBoundaryIs>"</span>
<span class="n">irh</span><span class="o">=</span><span class="s2">"<innerBoundaryIs><LinearRing><coordinates>"</span>
<span class="n">irf</span><span class="o">=</span><span class="s2">"</coordinates></LinearRing></innerBoundaryIs>"</span> <span class="n">proj</span><span class="o">=</span><span class="n">epsg</span><span class="p">:</span><span class="mi">4326</span>
<span class="n">precision</span><span class="o">=</span><span class="mi">10</span><span class="p">]</span>
<span class="o"></</span><span class="n">MultiGeometry</span><span class="o">></span>
</pre></div>
</div>
</dd>
<dt>[tileindex]</dt><dd><p>Index value of the current tile. If no tiles used for the current
shape this is replaced by "-1". Available only when processing
query results.</p>
</dd>
<dt>[item formatting options]</dt><dd><p>An attribute table “item”, with list formatting options. The
“name” attribute is required.</p>
<p>Available only when processing query results.</p>
<p>Available attributes:</p>
<ul class="simple">
<li><dl class="simple">
<dt>name =</dt><dd><p>The name of an attribute, case insensitive. (required)</p>
</dd>
</dl>
</li>
<li><dl class="simple">
<dt>precision =</dt><dd><p>The number of decimal places to use for numeric data. Use
of this will force display as a number and will lead to
unpredictable results with non-numeric data.</p>
</dd>
</dl>
</li>
<li><dl class="simple">
<dt>pattern =</dt><dd><p>Regular expression to compare the value of an item
against. The tag is output only if there is a match.</p>
</dd>
</dl>
</li>
<li><dl class="simple">
<dt>uc =</dt><dd><p>Set this attribute to “true” to convert the attribute
value to upper case.</p>
</dd>
</dl>
</li>
<li><dl class="simple">
<dt>lc =</dt><dd><p>Set this attribute to “true” to convert the attribute
value to lower case.</p>
</dd>
</dl>
</li>
<li><dl class="simple">
<dt>commify =</dt><dd><p>Set this attribute to “true” to add commas to a numeric
value. Again, only useful with numeric data.</p>
</dd>
</dl>
</li>
<li><dl class="simple">
<dt>escape =</dt><dd><p>Default escaping is for HTML, but you can escape for
inclusion in a URL (=url), or not escape at all (=none).</p>
</dd>
</dl>
</li>
<li><dl class="simple">
<dt>format =</dt><dd><p>A format string used to output the attribute value. The
token “$value” is used to place the value in a more
complex presentation. Default is to output only the
value.</p>
</dd>
</dl>
</li>
<li><dl class="simple">
<dt>ignoremissing =</dt><dd><p>Set this attribute to “true” to ignore errors if the
attribute set in name is missing for the feature. In this case
the nullformat value will be used, or an empty
string if not set. Useful for using the same template
for multiple datasets with variations in attribute names.</p>
</dd>
</dl>
</li>
<li><dl class="simple">
<dt>nullformat =</dt><dd><p>String to output if the attribute value is NULL, empty or
doesn’t match the pattern (if defined). If not set and
any of these conditions occur the item tag is replaced
with an empty string.</p>
</dd>
</dl>
</li>
<li><dl class="simple">
<dt>padding =</dt><dd><p>Set to an integer value to pad an item value with spaces
to the right. Useful to create fixed width strings.</p>
</dd>
</dl>
</li>
</ul>
<p>As a simple example:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="p">[</span><span class="n">item</span> <span class="n">name</span><span class="o">=</span><span class="s2">"area"</span> <span class="n">precision</span><span class="o">=</span><span class="s2">"2"</span> <span class="n">commify</span><span class="o">=</span><span class="s2">"2"</span> <span class="nb">format</span><span class="o">=</span><span class="s2">"Area is $value"</span><span class="p">]</span>
</pre></div>
</div>
</dd>
<dt>[attribute name],[attrribute name_esc],[attribute item name_raw]</dt><dd><p>Attribute name from the data table of a queried layer. Only
attributes for the active query layers are accessible. Case must
be the same as what is stored in the data file. ArcView, for
example, uses all caps for shapefile field names. Available only
when processing query results.</p>
<p>By default the attributes are encoded especially for HTML
representation. In addition the escaped version (for use in
URLs) as well as the raw data is available.</p>
</dd>
</dl>
<p>[Join name_attribute name],[Join name_attribute name_esc], [Join
name_attribute name_raw]</p>
<blockquote>
<div><p>One-to-one joins: First the join name (as specified in the
<a class="reference internal" href="index.html#mapfile"><span class="std std-ref">Mapfile</span></a> has to be given, second the tables fields can be
accessed similar to the layers attribute data. Available only
when processing query results.</p>
<p>By default the attributes are encoded especially for HTML
representation. In addition the escaped version (for use in URLs)
as well as the raw data is available.</p>
</div></blockquote>
<dl>
<dt>[join_Join name]</dt><dd><p>One-to-many joins: The more complex variant. If the join type is
multiple (one-to-many) the template is replaced by the set of
header, template file and footer specified in the <a class="reference internal" href="index.html#mapfile"><span class="std std-ref">Mapfile</span></a>.</p>
</dd>
<dt>[metadata_meta data key], [metadata_meta data key_esc]</dt><dd><p>Queried layer meta data access (e.g [metadata_projection]</p>
<p>Also available as escaped version.</p>
</dd>
</dl>
<p>For query modes that allow for multiple result sets, the following
string substitutions are available. For FEATURESELECT and
FEATURENSELECT modes the totals a re adjusted so as not to include the
selection layer. The selection layer results ARE available for display
to the user.</p>
<dl class="simple">
<dt>[nr]</dt><dd><p>Total number of results. Useful in web header and
footers. Available only when processing query results.</p>
</dd>
<dt>[nl]</dt><dd><p>Number of layers returning results. Useful in web header and
footers. Available only when processing query results.</p>
</dd>
<dt>[nlr]</dt><dd><p>Total number of results within the current layer. Useful in web
header and footers. Available only when processing query
results.</p>
</dd>
<dt>[rn]</dt><dd><p>Result number within all layers. Starts at 1. Useful in web
header and footers. Available only when processing query
results.</p>
</dd>
<dt>[lrn]</dt><dd><p>Result number within the current layer. Starts at 1. Useful in
query templates. Available only when processing query results.</p>
</dd>
<dt>[cl]</dt><dd><p>Current layer name. Useful in layer headers and footers. Available