summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/mercatormap/mercatormap.doc.drawing.tex
blob: a40131381f9d77d60740138f5fc7ea9cc1f3401d (plain)
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
% !TeX root = mercatormap.tex
% !TeX encoding=UTF-8
% !TeX spellcheck=en_US
% include file of mercatormap.tex (manual of the LaTeX package mercatormap)
\clearpage
\section{Map Drawing}

%-------------------------------------------------------------------------------
\subsection{Principal Drawing}

\begin{docCommand}{mrcdrawmap}{\oarg{options}}
  Inside a |tikzpicture| environment, \refCom{mrcdrawmap} draws a map
  prepared by \refCom{mrcdefinemap}, \refCom{mrcapplymap}, or \refCom{mrcmap}.
  All \meta{options} share the common prefix |/mermap/|.
  This is the principal macro to draw a prepared map respectively
  the background of the map. The background consists of downloaded map tiles
  or just a color rectangle.
\end{docCommand}

\begin{docMrcKey}{draw}{=\meta{tile draw}}{no default, initially |auto|}
  \begin{itemize}
  \item\docValue{auto}: Draws the map according to \refKey{/mermap/mapdef/resource},
    i.e. downloaded maps or tiles are used, if available.
  \item\docValue{path}: Draws the map according to the style given by
    \refKey{/mermap/map path}. Existing map tiles or merged maps are ignored
  \item\docValue{tiles}: Draws the map with downloaded map tiles, if
    available.
  \item\docValue{mergedmap}: Draws the map with a merged picture, if
    available.
  \item\docValue{wmsmap}: Draws the map with a downloaded WMS picture, if
    available.
  \end{itemize}
\end{docMrcKey}

\begin{docMrcKey}{map path}{=\meta{options}}{no default, initially |upper left=green!50,|\\|upper right=green!25, lower left=green!50!black!50, lower right=green!25|}
  Defines a \tikzname\ style for drawing the map without tiles.
  \meta{options} are feasible \tikzname\ path options.
\end{docMrcKey}

\begin{docMrcKey}{map clip}{=\meta{code}}{no default, initially \refCom{mrcclipmap}}
  Clipping options for the map. By default, the defined map is
  clipped with the full map rectangle. Use this option only, if you not want to clip
  the map to its specified size. \meta{code} is some \tikzname\ clipping code.
\end{docMrcKey}

\begin{docMrcKey}{map scope}{=\meta{options}}{no default, initially empty}
  \refCom{mrcdrawmap} uses a |scope| environment inside which takes
  the given \tikzname\ \meta{options}.
\end{docMrcKey}


\begin{docCommand}{mrcclipmap}{}
  Clips all subsequent drawings against the applied map.\\
  This is a shortcut macro identical to
  \begin{dispListing}
  \path[clip] (mrcmap.south west) rectangle (mrcmap.north east);
  \end{dispListing}
\end{docCommand}


\begin{docCommand}{mrcboundmap}{}
  Sets the picture bounding box according to the applied map.\\
  This is a shortcut macro identical to
  \begin{dispListing}
  \path[use as bounding box]
    (mrcmap.south west) rectangle (mrcmap.north east);
  \end{dispListing}
\end{docCommand}


\clearpage
%-------------------------------------------------------------------------------
\subsection{Flexible Tile Size}\label{sec:flexible_tile_size}

Typically, the pixel size of a map tile is fixed and a map tile is a
pixel graphics file. The actual size of such an included picture inside
the document is freely selectable. Note that a very small
\refKey{/mermap/tile size} results in very small map lettering,
while a very large \refKey{/mermap/tile size} results results in
very blurred images.

The general idea of a \emph{flexible} tile size is to specify an aspired
tile size called \refKey{/mermap/flex tile size} and to give \LaTeX\
the freedom to select \refKey{/mermap/tile size} in \emph{about the same size}
as \refKey{/mermap/flex tile size}.
This freedom is used to achieve a \emph{pseudo zoom} called
\refKey{/mermap/flex zoom} which is a nearly arbitrary rational number instead
of \refKey{/mermap/supply/zoom} which is a natural number.

This \emph{pseudo zoom} is applied by several options which share \emph{flex}
in their names, e.g.
\refKey{/mermap/flex scale}, \refKey{/mermap/named flex scale},
\refKey{/mermap/supply/flex reference scale},
\refKey{/mermap/supply/flex area scale},
\refKey{/mermap/supply/flex area fit}.



\begin{docMrcKey}{tile size}{=\meta{length}}{no default, initially |32.512mm|}
  Width and height of a drawn tile picture are set to \meta{length}.
  For standard tiles with 256 times 256 pixels a tile size of
  \SI{32.512}{mm} = \SI{1.28}{in} results in an approximate
  \SI{200}{dpi} output for the document.
  For a |beamer| document, consider to use a \refKey{/mermap/tile size} of
  \SI{21.333333}{mm} to get approximate 1:1 pixel input and output (depending on |beamer| settings
  and used hardware). Also see \refKey{/mermap/mapdef/tile size}.
\end{docMrcKey}

\begin{docMrcKey}{flex tile size}{=\meta{length}}{no default, initially |32.512mm|}
  Aspired width and height of a tile picture are set to \meta{length}.
  This value is used while applying \refKey{/mermap/flex zoom}.
\end{docMrcKey}


\begin{docMrcKey}{flex zoom}{=\meta{pseudo zoom}}{style, no default}
  This style sets \refKey{/mermap/supply/zoom} and \refKey{/mermap/tile size} in combination.
  \begin{itemize}
  \item
    If \meta{pseudo zoom} is a natural number,
    \refKey{/mermap/supply/zoom} is set to \meta{pseudo zoom} and
    \refKey{/mermap/tile size} is set to \refKey{/mermap/flex tile size}.
  \item Otherwise, \refKey{/mermap/supply/zoom} is set to the natural number
    closest to \meta{pseudo zoom} and \refKey{/mermap/tile size} is such
    enlarged or reduced that the \meta{pseudo zoom} value is simulated,
    i.e. the \emph{impression} of a rational zoom factor is given.
  \end{itemize}
  Note that \refKey{/mermap/flex zoom} has to be used \emph{before}
  \refCom{mrcsupplymap} or \refCom{mrcmap}, because the zoom setup is
  adapted.
\end{docMrcKey}


\clearpage
\begin{docMrcKey}{flex scale}{=\meta{scale denominator}:\meta{latitude}}{style, no default}
  For different latitude scopes, an identical zoom factor produces maps of
  different scale. With \refKey{/mermap/flex scale}, a \refKey{/mermap/flex zoom}
  is computed to achieve the given \meta{scale denominator} at a given \meta{latitude}.
  Note that this only applies to the center of a map. If the produced
  map is not centered at \meta{latitude}, the produced scale may
  differ from the intended one.
  Also see \refKey{/mermap/supply/flex reference scale}.

\tikzsetnextfilename{drawing_flex_scale}%
\begin{dispExample}
\begin{tikzpicture}
  \mermapset{flex scale=250000:48.14}
  \mrcmap[type=reference,latitude=48.14,longitude=11.57,
    source=opentopomap,
    tex width=\linewidth,tex height=5cm]{}
  \mrcdrawmap
  \node[below,font=\fontsize{7pt}{7pt}\sffamily] at (mrcmap.south)
        {\mrcmapattribution};
  \mrcclipmap
  \path[draw] (mrcmap.south west) rectangle (mrcmap.north east);
  \node[below left=2mm, align=right, fill=white, fill opacity=0.5,
      text opacity=1]
    at (mrcmap.north east) {scale \mrcprettymapscale};
\end{tikzpicture}
\end{dispExample}
\end{docMrcKey}



\begin{docMrcKey}{named flex scale}{=\meta{scale denominator}:\meta{name}}{style, no default}
  Identical to \refKey{/mermap/flex scale}, but used the \emph{named position}
  \meta{name} to provide a \emph{latitude}, see \Fullref{sec:names_positions}.
  \begin{dispListing}
  \mrcNPdef{munich}{48.137222}{11.575556}
  \mermapset{named flex scale=250000:munich} % identical to the following
  \mermapset{flex scale=250000:\mrcNPlat{munich}}
  \end{dispListing}
\end{docMrcKey}



\clearpage
%-------------------------------------------------------------------------------
\subsection{Geodetic Network}

\begin{docCommand}{mrcdrawnetwork}{\oarg{options}}
  Draws a geodetic network with meridians and parallels.
  All \meta{options} share the common prefix |/mermap/|.
  The displayed lines are selected automatically according to some tuning
  parameters.
  The map is sliced in \emph{about} maximal \refKey{/mermap/network pieces} in each
  direction. Meridians and parallels share a minimal distance of
  \emph{about} \refKey{/mermap/network distance}. The algorithm is
  allowed to violate these conditions \emph{somewhat}.

  Note that oversized maps are not supported, i.e. maps which are wider
  than \ang{360} in longitude. Here, meridians are expected to be missing
  or misplaced.

\tikzsetnextfilename{drawing_network}%
\begin{dispExample*}{center lower}
% \mrcsetapikey{openrouteservice}{YOUR-API-KEY}  % registered key
\begin{tikzpicture}
  \mrcmap[  type = boundaries,
    west = -20, east = 40, south = 36, north = 65,
    source=openrouteservice mapsurfer,
    flex area scale=40 000 000 ]{}
  \mrcdrawmap
  \node[below,font=\fontsize{7pt}{7pt}\sffamily] at (mrcmap.south)
        {\mrcmapattribution};
  \mrcclipmap
  \mrcdrawnetwork
  \path[draw] (mrcmap.south west) rectangle (mrcmap.north east);
\end{tikzpicture}
\end{dispExample*}
\end{docCommand}


\begin{docMrcKey}{network pieces}{=\meta{number}}{no default, initially |8|}
  The map is sliced in \emph{about} maximal \meta{number} pieces in each
  direction. \meta{number} may be exceeded \emph{somewhat}.
  It is underrun to comply with \refKey{/mermap/network distance}.
\end{docMrcKey}


\begin{docMrcKey}{network distance}{=\meta{mesh width}}{no default, initially |2cm|}
  Meridians and parallels share a minimal distance of
  \emph{about} \meta{mesh width}.
  \meta{mesh width} may be underrun \emph{somewhat}.
  It is exceeded to comply with \refKey{/mermap/network pieces}.
  For parallels on small scale maps, it refers to an averaged mesh width.
\end{docMrcKey}

\begin{docMrcKey}{network font}{=\meta{text}}{no default, initially
  |\textbackslash fontsize\brackets{4pt}\brackets{4pt}\textbackslash sffamily|}
  \meta{text} is some font setting for the latitude and longitude display.
\end{docMrcKey}



\subsection{Graphical Debug Overlay}

\begin{docCommand}{mrcdrawinfo}{}
  Draws some map information overlay for debugging purposes only.
  \tikzsetnextfilename{drawing_mrcdrawinfo}%
  \begin{dispExample}
  \begin{tikzpicture}
    \mrcNPdef{munich}{48.137222}{11.575556}
    \mrcmap[type=reference, named position=munich, source=opentopomap,
      flex reference scale=50000,
      tex width=\linewidth,tex height=10cm]{}
    \mrcdrawmap
    \node[below,font=\fontsize{7pt}{7pt}\sffamily] at (mrcmap.south)
          {\mrcmapattribution};
    \mrcclipmap
    \mrcdrawinfo
  \end{tikzpicture}
  \end{dispExample}
\end{docCommand}