Debian Codegraph @

texmf-dist/doc/latex/mercatormap/mercatormap.doc.examples.tex

raw
1 % !TeX root = mercatormap.tex
2 % !TeX encoding=UTF-8
3 % !TeX spellcheck=en_US
4 % include file of mercatormap.tex (manual of the LaTeX package mercatormap)
5 \clearpage
6 \section{Examples}\label{sec:examples}%
7
8 The following map examples may be used as tutorials and
9 starting point for own applications.
10 Also see |mercatormap-example.tex| for a compilable full example.
11 Note to do all preparations documented in \Fullref{sec:python}.
12
13
14 %-------------------------------------------------------------------------------
15 \subsection{Reference Position}
16
17 With \refKey{mermap/supply/type}|=|\docValue{reference} a map with a
18 \emph{reference position} is constructed. Here, Munich is taken as
19 reference position and center of the map. Since the position is used
20 more than once, it is stored with \refCom{mrcNPdef} for further reference.
21 With \refKey{mermap/supply/flex reference scale} the scale
22 is set to 1:6\,000\,000. For the background map tiles, a
23 \refKey{mermap/supply/source} is selected for download.
24 This setup is done by \refCom{mrcmap} while \refCom{mrcdrawmap} draws
25 the downloaded map tiles.
26
27 \tikzsetnextfilename{examples_reference}%
28 \begin{dispExample*}{center lower, breakable}
29 \begin{tikzpicture}
30 \sffamily
31 \mrcNPdef{munich}{48.137222}{11.575556}
32 \mrcNPdef{vienna}{48.208333}{16.373056}
33 \mrcNPdef{cologne}{50.938056}{6.956944}
34 \mrcNPdef{milano}{45.4625}{9.186389}
35 \mrcmap[
36 type = reference,
37 named position = munich,
38 flex reference scale = 6 000 000,
39 source = topplusopen web,
40 tex width = 14cm,
41 tex height = 14cm
42 ]{examples_reference}
43 \path[draw=yellow!50!gray,fill=yellow!20]
44 ([xshift=-2mm,yshift=-5mm]mrcmap.south west) rectangle
45 ([xshift=2mm,yshift=15mm]mrcmap.north east);
46 \mrcdrawmap
47 \node[below,font=\fontsize{7pt}{7pt}\sffamily] at (mrcmap.south)
48 {\mrcmapattribution};
49 \path[draw=yellow!50!gray] (mrcmap.south west) rectangle (mrcmap.north east);
50
51 \mrcNPdraworthodrome[red,very thick]{munich}{milano}
52 \path[blue,very thick] (\mrcNPcs{munich}) --
53 node[red,fill=white,sloped,below] {\mrcNPprettyorthodistance{munich}{milano}}
54 (\mrcNPcs{milano});
55
56 \mermapsetmarker{type=pin, draw=red, fill=red!10, font=\sffamily\small}
57 \mrcmarker{named position=munich, contents={M\"unchen}}
58 \mrcmarker{named position=vienna, contents={Wien}}
59 \mrcmarker{named position=cologne, contents={K\"oln}}
60 \mrcmarker{named position=milano, contents={Milano}}
61
62 \node[above left=5mm,font=\Large\bfseries] at (mrcmap.north east) {Munich};
63
64 \node[above right] at ([yshift=10mm]mrcmap.north west)
65 {Scale \mrcprettymapscale};
66
67 \mrcdrawscalebar[width-in-km=300,partitions=6,north-west-outside=0mm;5mm,
68 single, height=1mm, major style={yellow!50!gray!50!black}]
69 \path[every node/.style={above,inner sep=0.5mm,font=\sffamily\tiny}]
70 (mrcscalebar.north west) -- (mrcscalebar.north east)
71 node[pos=0]{0} node[pos=0.3333]{100} node[pos=0.6667]{200}
72 node[pos=1]{300\,km};
73
74 \mrcdrawscalebar[width-in-mile=200,partitions=8,
75 at={(mrcscalebar.south west)},placement=below right,
76 single, height=1mm, major style={yellow!50!gray!50!black}]
77 \path[every node/.style={below,inner sep=0.5mm,font=\sffamily\tiny}]
78 (mrcscalebar.south west) -- (mrcscalebar.south east)
79 node[pos=0]{0} node[pos=0.25]{50} node[pos=0.5]{100} node[pos=0.75]{150}
80 node[pos=1]{200\,miles};
81 \end{tikzpicture}
82 \end{dispExample*}
83
84
85 \clearpage
86 %-------------------------------------------------------------------------------
87 \subsection{Fitting Area}
88
89 With \refKey{mermap/supply/type}|=|\docValue{areafit} a map is constructed
90 where a given area is fitted in. The following example lists some
91 US-American cities and constructs an \refKey{mermap/supply/area} which
92 contains all of them. With \refKey{mermap/supply/flex area fit}|=15mm| a
93 border region is added.
94
95 \enlargethispage*{10mm}
96
97 \tikzsetnextfilename{examples_fitting_area}%
98 \begin{dispExample*}{center lower}
99 \begin{tikzpicture}
100 \mrcNPdef{honolulu}{21.305225}{-157.867}
101 \mrcNPdef{fairbanks}{64.8379435}{-147.7192214}
102 \mrcNPdef{sandiego}{32.7146781}{-117.1640995}
103 \mrcNPdef{miami}{25.7599333}{-80.1951257}
104 \mrcNPdef{boston}{42.359744}{-71.061322}
105 \mrcNPdef{denver}{39.7372435}{-104.997378}
106 \mrcmap[
107 type = areafit,
108 area = {honolulu,fairbanks,sandiego,miami,boston,denver},
109 source = topplusopen web,
110 tex width = 15cm,
111 tex height = 11cm,
112 flex area fit = 15mm
113 ]{examples_fitting_area}
114 \mrcdrawmap \mrcdrawnetwork
115 \node[below,font=\fontsize{7pt}{7pt}\sffamily] at (mrcmap.south)
116 {\mrcmapattribution};
117 \node[below left,fill=white,opacity=0.8,text opacity=1] at (mrcmap.north east)
118 {Scale \mrcprettymapscale};
119 \path[draw] (mrcmap.south west) rectangle (mrcmap.north east);
120 \foreach \city in {honolulu,fairbanks,sandiego,miami,boston,denver}
121 {\mrcmarker{type=ringx, draw=red, fill=red!20, named position=\city}}
122 \end{tikzpicture}
123 \end{dispExample*}
124
125
126 \clearpage
127 %-------------------------------------------------------------------------------
128 \subsection{Fixed Boundaries}
129
130 With \refKey{mermap/supply/type}|=|\docValue{boundaries} a map is constructed
131 with fixed boundaries. In contrast to the other map types, the document
132 map size cannot be given directly but derives from the map setup. This bears
133 the risk of too large maps. The following example is a map with exact
134 boundaries \mrcformlat{-45} to \mrcformlat{-10}
135 and \mrcformlon{110} to \mrcformlon{155}. A decent \refKey{mermap/supply/zoom}
136 is 5 (every zoom step doubles the map size in each direction).
137
138 \tikzsetnextfilename{examples_boundaries}%
139 \begin{dispExample*}{center lower,breakable}
140 % \mrcsetapikey{thunderforest}{YOUR-API-KEY} % registered key
141 \begin{tikzpicture}
142 \mrcmap[
143 type = boundaries,
144 west = 110, east = 155, south = -45, north = -10,
145 zoom = 5, source = thunderforest outdoors,
146 ]{examples_boundaries}
147 \mrcdrawmap
148 \node[below,font=\fontsize{7pt}{7pt}\sffamily] at (mrcmap.south)
149 {\mrcmapattribution};
150 \mrcdrawnetwork
151 \mrcdrawscalebar[width-in-km=1000,partitions=4,south-west-inside=5mm,
152 major style={blue!50!gray!50!black}]
153 \path[every node/.style={below,inner sep=0.5mm,font=\sffamily\tiny}]
154 (mrcscalebar.south west) -- (mrcscalebar.south east)
155 node[pos=0]{0} node[pos=0.5]{500}
156 node[pos=1]{1000} node[pos=1,right,yshift=1mm]{km};
157 \mrcmarker{lat=-35.3,lon=149.116667,type=pictodropring,
158 draw=red,fill=red!10}
159 \end{tikzpicture}
160 \end{dispExample*}
161
162
163 \clearpage
164 %-------------------------------------------------------------------------------
165 \subsection{Map Without Map Tiles}
166
167 There is no coercion to use downloaded map tiles, if they are not needed or
168 wanted. With \refKey{mermap/supply/target}|=none| no map tiles are downloaded.
169 The following example draws a rough polygon shape of Germany using
170 \refEnv{mrcroute*}.
171
172 \tikzsetnextfilename{examples_routemap}%
173 \begin{dispExample*}{center lower,breakable}
174 \begin{tikzpicture}
175 \mrcNPdef{munich}{48.137222}{11.575556}
176 \mrcNPdef{cologne}{50.938056}{6.956944}
177 \mrcNPdef{hamburg}{53.550556}{9.993333}
178 \mrcNPdef{berlin}{52.518611}{13.408333}
179 \mrcmap[
180 type = areafit,
181 west = 5, east = 15, south = 47, north = 55,
182 target = none,
183 tex width = 14cm, tex height = 14cm,
184 flex area fit = 5mm
185 ]{examples_routemap}
186 \mrcclipmap
187 \path[draw,fill=yellow!5] (mrcmap.south west) rectangle (mrcmap.north east);
188 \begin{mrcroute*}[
189 preaction={fill=black,opacity=.5,
190 transform canvas={xshift=1mm,yshift=-1mm}},
191 draw = green!50!black,
192 top color = green!50!gray!5,
193 bottom color = green!50!gray!15]
194 \mrcpoint{47.57268069220318}{8.07968771809688}
195 \mrcpoint{47.55206513030159}{8.458302263852103}
196 \mrcpoint{47.60652271644701}{8.58564576447632}
197 \mrcpoint{47.65002478441761}{8.475977737743394}
198 \mrcpoint{47.8129149100372}{8.621611270810012}
199 \mrcpoint{47.70405949548734}{8.824753417980977}
200 \mrcpoint{47.57118357939037}{9.373387060586875}
201 \mrcpoint{47.57763968687206}{9.783024034250792}
202 \mrcpoint{47.46598581489455}{10.09335967295321}
203 \mrcpoint{47.28014625489598}{10.22678291669482}
204 \mrcpoint{47.32098723021947}{10.40092026792467}
205 \mrcpoint{47.52413897927237}{10.53589647271817}
206 \mrcpoint{47.5130331145614}{10.94403341747166}
207 \mrcpoint{47.39097338968944}{11.04734763681045}
208 \mrcpoint{47.42252867275465}{11.44170163808758}
209 \mrcpoint{47.57832219946236}{11.64025530020549}
210 \mrcpoint{47.65203740659043}{12.2451260343467}
211 \mrcpoint{47.64005851006706}{12.78135708694006}
212 \mrcpoint{47.42189293170733}{13.06242166895717}
213 \mrcpoint{47.68727761120528}{13.13421507093485}
214 \mrcpoint{47.70570852317097}{12.97737528172392}
215 \mrcpoint{47.86836520373472}{12.94442906710615}
216 \mrcpoint{48.06063312315187}{12.76937524145701}
217 \mrcpoint{48.33220372303314}{13.38497370385176}
218 \mrcpoint{48.57060635511297}{13.55281830406328}
219 \mrcpoint{48.51465473490364}{13.78916086481733}
220 \mrcpoint{48.74889509826911}{13.84448153318651}
221 \mrcpoint{48.95974762545411}{13.50952525317658}
222 \mrcpoint{49.37838143356481}{12.77000417129028}
223 \mrcpoint{49.78495654813383}{12.44617209199484}
224 \mrcpoint{49.93155217044134}{12.49159565814237}
225 \mrcpoint{50.13144236663469}{12.24546848540114}
226 \mrcpoint{50.28771270517358}{12.30810150664619}
227 \mrcpoint{50.40989390494432}{12.94903619964524}
228 \mrcpoint{50.65841629251407}{13.3075062965852}
229 \mrcpoint{50.76329878585482}{13.97452403458363}
230 \mrcpoint{51.02604511746936}{14.41278607347103}
231 \mrcpoint{50.79185062876172}{14.80477069337384}
232 \mrcpoint{51.15202957355457}{14.99270251686064}
233 \mrcpoint{51.34128169635556}{15.02098384386006}
234 \mrcpoint{51.53750266315752}{14.74120138252564}
235 \mrcpoint{51.81924062442433}{14.62724686001225}
236 \mrcpoint{52.11180711219343}{14.70514397703483}
237 \mrcpoint{52.39266284958671}{14.60756306378661}
238 \mrcpoint{52.60597277515545}{14.58725108586684}
239 \mrcpoint{52.88134471470577}{14.16977248675916}
240 \mrcpoint{53.14560306739344}{14.4215985570986}
241 \mrcpoint{53.43447627332744}{14.39440456086107}
242 \mrcpoint{53.76080228279986}{14.26477636730856}
243 \mrcpoint{54.07894830697219}{13.84113247149844}
244 \mrcpoint{54.34144910466647}{13.71477685386829}
245 \mrcpoint{54.57879841452108}{13.41784866398943}
246 \mrcpoint{54.38430816973541}{12.55218424463898}
247 \mrcpoint{54.16285895583508}{12.11170524536321}
248 \mrcpoint{54.11909611435144}{11.78253136604545}
249 \mrcpoint{53.9629318241985}{11.23001765303107}
250 \mrcpoint{54.02548042559235}{10.82100535035693}
251 \mrcpoint{54.20942342601608}{11.17572026938692}
252 \mrcpoint{54.42622022041155}{11.04601054827628}
253 \mrcpoint{54.31534430886417}{10.73027571352005}
254 \mrcpoint{54.4430955768925}{10.19233706975044}
255 \mrcpoint{54.8317448735389}{10.00757468096804}
256 \mrcpoint{54.87986478845961}{9.659528688958062}
257 \mrcpoint{54.8308224503691}{9.271730840012292}
258 \mrcpoint{54.92302453288877}{8.571394535898566}
259 \mrcpoint{54.49119535498197}{8.900730234661252}
260 \mrcpoint{54.34335254823343}{8.645116397508792}
261 \mrcpoint{54.22420563732749}{8.880431477246834}
262 \mrcpoint{53.87404422621243}{8.679945700393079}
263 \mrcpoint{53.54658560722722}{8.286556227539295}
264 \mrcpoint{53.7066272365128}{8.034813408953866}
265 \mrcpoint{53.78031118673399}{7.387421106389351}
266 \mrcpoint{53.51218238635882}{6.930006752473437}
267 \mrcpoint{53.25894778199789}{7.171145313101468}
268 \mrcpoint{52.64374200661974}{6.997019504055286}
269 \mrcpoint{52.55662475372522}{6.719778263650637}
270 \mrcpoint{52.38988292317155}{6.970320972580792}
271 \mrcpoint{51.92299983362206}{6.742905287863996}
272 \mrcpoint{51.88316670940459}{6.156741607019097}
273 \mrcpoint{51.79567780329431}{5.98801954642294}
274 \mrcpoint{51.43928428452571}{6.159613225461791}
275 \mrcpoint{51.0215877919207}{5.887936542477828}
276 \mrcpoint{50.79077378475993}{5.983374968822379}
277 \mrcpoint{50.59470107381249}{6.228393825507839}
278 \mrcpoint{50.33147032961352}{6.304617231833176}
279 \mrcpoint{50.15747573005454}{6.092865298740861}
280 \mrcpoint{49.97845765993797}{6.16527138749146}
281 \mrcpoint{49.78369815200002}{6.535162836379246}
282 \mrcpoint{49.45067080157749}{6.378063336429978}
283 \mrcpoint{49.11701097547841}{6.794068795882435}
284 \mrcpoint{49.14800972775451}{7.494253217695865}
285 \mrcpoint{49.03198382192998}{7.640486837553122}
286 \mrcpoint{48.92859396692077}{8.238456398546767}
287 \mrcpoint{48.61606185482966}{7.832853167339047}
288 \mrcpoint{48.05389084062409}{7.510556381211842}
289 \mrcpoint{47.56795313962416}{7.588782160556193}
290 \mrcpoint{47.57268069220318}{8.07968771809688}
291 \end{mrcroute*}
292 \foreach \city / \name in {munich/M\"unchen, cologne/K\"oln,
293 hamburg/Hamburg, berlin/Berlin}
294 {
295 \mrcmarker{named position=\city,type=knob,fill=red!20,draw=red,
296 radius=2mm}
297 \mrcmarker{named position=\city,type=pin,fill=blue!10,draw=blue,
298 contents=\name}
299 }
300 \end{tikzpicture}
301 \end{dispExample*}
302
303
304 \clearpage
305 %-------------------------------------------------------------------------------
306 \subsection{Alignment of the Reference Position}
307
308 With \refKey{mermap/supply/align} the reference position can be aligned
309 at different map positions.
310
311 \tikzsetnextfilename{examples_alignment}%
312 \begin{dispExample*}{center lower}
313 \mrcNPdef{munich}{48.137222}{11.575556}
314 \foreach \a in {east,center,west,north} {
315 \begin{tikzpicture}
316 \mrcmap[type = reference,
317 named position = munich,
318 flex reference scale = 1 000 000,
319 source = opentopomap,
320 tex width = \linewidth, tex height = 3cm,
321 align = \a ]{examples_alignment_\a}
322 \mrcdrawmap
323 \node[below,font=\fontsize{7pt}{7pt}\sffamily] at (mrcmap.south)
324 {\mrcmapattribution}; \mrcclipmap
325 \tikzset{every node/.style={fill=white,fill opacity=0.8,text opacity=1}}
326 \path[draw] (mrcmap.south west) rectangle (mrcmap.north east);
327 \ifmrcNPinvicinity{munich}{
328 \fill[red] (mrcpos) circle (4pt) node[below] {M\"unchen};}{}
329 \node[text=red,above left] at (mrcmap.south east) {align=\a};
330 \end{tikzpicture}
331 \par}
332 \end{dispExample*}
333
334
335
336 \clearpage
337 %-------------------------------------------------------------------------------
338 \subsection{Flexible Zoom}
339
340 Map tiles are only provided at fixed zoom levels with natural numbers,
341 but the package allows a \refKey{mermap/flex zoom} with rational numbers.
342 The flexible zoom is realized by combining a suitable fixed zoom with
343 an adapted document tile scaling, see \Fullref{sec:flexible_tile_size}.
344 The following example shows a more or less smooth zoom increase.
345 The same technique is used by all options starting with |flex|, e.g.
346 \refKey{mermap/supply/flex reference scale}
347 or \refKey{mermap/supply/flex area fit}
348 as seen in the examples before.
349
350 \tikzexternaldisable
351 \tikzsetnextfilename{examples_flex_zoom}%
352 \begin{dispExample*}{center lower,breakable}
353 % \mrcsetapikey{thunderforest}{YOUR-API-KEY} % registered key
354 \mrcNPdef{munich}{48.137222}{11.575556}
355 \foreach \zz in {7.0,7.2,...,9.0} {
356 \edef\z{\fpeval{round(\zz,1)}}
357 \begin{tikzpicture}
358 \mermapset{flex zoom=\z}
359 \mrcmap[type = reference,
360 named position = munich,
361 source = thunderforest outdoors,
362 tex width = \linewidth,
363 tex height = 3cm
364 ]{examples_flex_zoom_\z}
365 \mrcdrawmap
366 \mrcclipmap
367 \tikzset{every node/.style={fill=white,fill opacity=0.5,text opacity=1}}
368 \node[above,font=\fontsize{7pt}{7pt}\sffamily] at (mrcmap.south)
369 {\mrcmapattribution};
370 \path[draw] (mrcmap.south west) rectangle (mrcmap.north east);
371 \node[below left=2mm,align=right] at (mrcmap.north east)
372 {flex zoom=\fpeval{round(\z,1)}\\ scale \mrcprettymapscale};
373 \ifmrcNPinvicinity{munich}{
374 \fill (mrcpos) circle (2pt) node[below] {M\"unchen};}{}
375 \end{tikzpicture}\par}
376 \end{dispExample*}
377
378
379