From 43255aab4df3eb4f9d71e5f80e9bab45f8bdad72 Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Fri, 25 Jul 2014 21:03:41 +0000 Subject: getmap (25jul14) git-svn-id: svn://tug.org/texlive/trunk@34723 c570f23f-e606-0410-a88d-b1316a301751 --- Master/texmf-dist/doc/latex/getmap/README | 10 +- .../texmf-dist/doc/latex/getmap/getmap-example.tex | 12 +- Master/texmf-dist/doc/latex/getmap/getmap.dtx | 429 ++++++++++++++++++--- Master/texmf-dist/doc/latex/getmap/getmap.pdf | Bin 1379860 -> 1697615 bytes Master/texmf-dist/doc/latex/getmap/install.bat | 1 + Master/texmf-dist/doc/latex/getmap/makefile | 2 +- Master/texmf-dist/doc/latex/getmap/manifest.txt | 1 + Master/texmf-dist/scripts/getmap/getmapdl.lua | 39 +- Master/texmf-dist/tex/latex/getmap/getmap.sty | 60 ++- 9 files changed, 478 insertions(+), 76 deletions(-) (limited to 'Master') diff --git a/Master/texmf-dist/doc/latex/getmap/README b/Master/texmf-dist/doc/latex/getmap/README index ef0789ff1ec..ecc89af94ff 100644 --- a/Master/texmf-dist/doc/latex/getmap/README +++ b/Master/texmf-dist/doc/latex/getmap/README @@ -8,11 +8,15 @@ use this script also from the command line. License: LPPL -Changes in v1.3: +Changes in v1.4: -- added support for Google Street View +- added new options in gm mode - * new options heading, pitch, fov + * language (language of map labels) + * markers (set marker on map) + * visible (ensure locations to be on the map) + * path (draw pathes and routes) + * pathfile (load complicated encoded polylines (routes)) - added more examples to the documentation diff --git a/Master/texmf-dist/doc/latex/getmap/getmap-example.tex b/Master/texmf-dist/doc/latex/getmap/getmap-example.tex index 8029e5f0cfe..4efb44ce7ed 100644 --- a/Master/texmf-dist/doc/latex/getmap/getmap-example.tex +++ b/Master/texmf-dist/doc/latex/getmap/getmap-example.tex @@ -34,11 +34,19 @@ \documentclass{article} \usepackage[utf8]{inputenc} \usepackage{graphicx} +\usepackage{filecontents} %% use overwrite while optimizing the image \usepackage[overwrite,mode=gm]{getmap} \begin{document} -\getmap[type=satellite,scale=2,zoom=16]{Estádio do Maracanã, Rio de Janeiro} -\includegraphics[width=10cm]{getmap} +\begin{filecontents*}{muc.epl} +&path=weight:5|color:orange|enc:okydHa}peAXOHi@jANv@A@kJJmFAiDJuAHmDXcBb@cC`@gC^_DV}CJaCF{APaBVkBdAyEf@qC`@{B\aDSwB +\end{filecontents*} +\getmap[file=muc, + markers={&markers=size:mid|label:H|color:green|München, Hbf + &markers=label:S|color:yellow|Stachus, München + &markers=label:M|color:blue|Marienplatz, München}, + pathfile={muc.epl}]{} +\includegraphics[width=10cm]{muc} \end{document} \endinput %% diff --git a/Master/texmf-dist/doc/latex/getmap/getmap.dtx b/Master/texmf-dist/doc/latex/getmap/getmap.dtx index d429d1e91e1..1ec2fec9715 100644 --- a/Master/texmf-dist/doc/latex/getmap/getmap.dtx +++ b/Master/texmf-dist/doc/latex/getmap/getmap.dtx @@ -14,11 +14,15 @@ use this script also from the command line. License: LPPL -Changes in v1.3: +Changes in v1.4: -- added support for Google Street View +- added new options in gm mode - * new options heading, pitch, fov + * language (language of map labels) + * markers (set marker on map) + * visible (ensure locations to be on the map) + * path (draw pathes and routes) + * pathfile (load complicated encoded polylines (routes)) - added more examples to the documentation @@ -100,6 +104,20 @@ download getmap.dtx and makefile (Linux) or install.bat (Windows) title = {{Google Street View Image API}}, year = {2014}, } + +@misc{bib:googlepla, + author = {{Google, Inc.}}, + note = {\href{https://developers.google.com/maps/documentation/utilities/polylinealgorithm}{https://developers.google.com/maps/documentation/utilities/polylinealgorithm}}, + title = {{Encoded Polyline Algorithm Format}}, + year = {2014}, + } + +@misc{bib:googleipeu, + author = {{Google, Inc.}}, + note = {\href{https://developers.google.com/maps/documentation/utilities/polylineutility}{https://developers.google.com/maps/documentation/utilities/polylineutility}}, + title = {{Interactive Polyline Encoder Utility}}, + year = {2014}, + } % %<*luafile> @@ -107,7 +125,7 @@ download getmap.dtx and makefile (Linux) or install.bat (Windows) -- -- getmapdl [options] -- --- downloads an OpenStreetMap or Google Maps map specified by [options] +-- downloads an OpenStreetMap, Google Maps or Google Street View map specified by [options] -- -- License: LPPL -- @@ -133,13 +151,15 @@ local COLOR = "" local NUMBER = "" local VISIBLE = "" local IPATH = "" +local FPATH = "" local MARKERS = "" local HEADING = "" local FOV = "" local PITCH = "" +local LANGUAGE = "" local OFILE = "getmap" local QUIET = "false" -local VERSION = "v1.1 (19/07/2014)" +local VERSION = "v1.2 (25/07/2014)" function pversion() print("getmapdl.lua " .. VERSION) @@ -166,7 +186,7 @@ getmapdl.lua [options] -S short form to specify a size, e.g. 600,400 (osm) or 600x400 (gm) - -s specify a scale factor in the range 1692-221871572 (osmm) or + -s specify a scale factor in the range 1692-221871572 (osm) or 1-2 (osm) -z specify a zoom in the range 1-18 (osm) or 0-21 (17) (gm) @@ -193,6 +213,8 @@ getmapdl.lua [options] gm mode only: + -L specify the language of map labels (xx language code (en,de,fr,...)) + -M specify markers; see: https://developers.google.com/maps/documentation/staticmaps/index#Markers e.g.: &markers=size:mid|color:blue|label:1|address or more of these @@ -204,6 +226,9 @@ getmapdl.lua [options] -P specify path from location to location e.g.: &path=weight:7|color:purple|loc1|loc2 + + -p specify a file holding the path specification + (maybe needed for encoded polylines) gsv mode only: @@ -284,6 +309,9 @@ do elseif arg[i] == "-n" then NUMBER = arg[i+1] i = i + 1 + elseif arg[i] == "-L" then + LANGUAGE = arg[i+1] + i = i + 1 elseif arg[i] == "-M" then MARKERS = arg[i+1] i = i + 1 @@ -302,6 +330,9 @@ do elseif arg[i] == "-P" then IPATH = arg[i+1] i = i + 1 + elseif arg[i] == "-p" then + FPATH = arg[i+1] + i = i + 1 elseif arg[i] == "-o" then OFILE = arg[i+1] i = i + 1 @@ -465,9 +496,12 @@ local USHOWICON = "" local UIMAGETYPE = "" local UVISIBLE = "" local UIPATH = "" +local UFPATH = "" +local EPLFILE = "" local UHEADING = "" local UFOV = "" local UPITCH = "" +local ULANGUAGE = "" local UOFILE = "" local IMGURL = "" @@ -506,8 +540,23 @@ if MODE == "gm" then -- correct cruft escaping of "&path=" UIPATH = UIPATH:gsub("%%26path%%3d","&path=") end + if FPATH == "" then + UFPATH = "" + else + EPLFILE = io.open(FPATH, "r") + local contents = EPLFILE:read() + EPLFILE:close() + UFPATH = "" .. url.escape(contents) + -- correct cruft escaping of "&path=" + UFPATH = UFPATH:gsub("%%26path%%3d","&path=") + end + if LANGUAGE == "" then + ULANGUAGE="" + else + ULANGUAGE="&language=" .. LANGUAGE + end UOFILE = OFILE .. "." .. IMAGETYPE - IMGURL = GMURL .. "?" .. ULOCATION .. USIZE .. UZOOM .. UMARKERS .. UTYPE .. USCALE .. UIMAGETYPE .. UVISIBLE .. UIPATH .. "&sensor=false" + IMGURL = GMURL .. "?" .. ULOCATION .. USIZE .. UZOOM .. UMARKERS .. UTYPE .. USCALE .. UIMAGETYPE .. UVISIBLE .. UIPATH .. UFPATH .. ULANGUAGE .. "&sensor=false" elseif MODE == "gsv" then ULOCATION = "location=" .. url.escape(LOCATION) USIZE = "&size=" .. url.escape(SIZE) @@ -572,13 +621,21 @@ end \documentclass{article} \usepackage[utf8]{inputenc} \usepackage{graphicx} +\usepackage{filecontents} % \iffalse %% use overwrite while optimizing the image % \fi \usepackage[overwrite,mode=gm]{getmap} \begin{document} -\getmap[type=satellite,scale=2,zoom=16]{Estádio do Maracanã, Rio de Janeiro} -\includegraphics[width=10cm]{getmap} +\begin{filecontents*}{muc.epl} +&path=weight:5|color:orange|enc:okydHa}peAXOHi@jANv@A@kJJmFAiDJuAHmDXcBb@cC`@gC^_DV}CJaCF{APaBVkBdAyEf@qC`@{B\aDSwB +\end{filecontents*} +\getmap[file=muc, + markers={&markers=size:mid|label:H|color:green|München, Hbf + &markers=label:S|color:yellow|Stachus, München + &markers=label:M|color:blue|Marienplatz, München}, + pathfile={muc.epl}]{} +\includegraphics[width=10cm]{muc} \end{document} % %<*manifest> @@ -596,6 +653,7 @@ getmap.sty getmap.cfg getmap-example.tex getmapdl.lua +manifest.txt % %<*internal> \fi @@ -684,6 +742,7 @@ This work consists of all files listed in manifest.txt. \usepackage{tabularx} \usepackage{microtype}% \usepackage{listings} +\usepackage{filecontents} \usepackage{nicefrac} \usepackage[numbered]{hypdoc} \usepackage{marginnote}% @@ -868,7 +927,7 @@ emph={}} %\hypersetup{pdfauthor={Josef Kleber},pdftitle={Downloading maps from OpenStreetMap, Google Maps or Google Street View},pdfsubject={Documentation for LaTeX style \filename},pageanchor=true,hyperindex=true}% %\lstset{language=[LaTeX]TeX,numbers=left,numberstyle=\tiny, basicstyle=\ttfamily, aboveskip=\baselineskip, frame=single, backgroundcolor=\color{LightGoldenrodYellow}, keywordstyle=\color{Blue}, %emph={},emphstyle=\color{Tomato}, -%emph={[2]width,xsize,ysize,zoom,scale,mode,file,type,heading,pitch,fov},emphstyle={[2]\color{OliveDrab}}, +%emph={[2]width,xsize,ysize,zoom,scale,mode,file,type,heading,pitch,fov,markers,visible,path,pathfile},emphstyle={[2]\color{OliveDrab}}, %morekeywords={getmap,includegraphics}} %\DoNotIndex{\,,\begingroup,\endgroup,\csname,\def,\else,\endcsname,\equal,\expandafter, %\fi,\gdef,\ifnum,\ifthenelse,\immediate,\MessageBreak,\NeedsTeXFormat,\newcommand,\newif, @@ -922,9 +981,28 @@ emph={}} % \section{Options} % The following options can be used as package options with global scope, % as well as options for the \cmd\getmap\ command with local scope! -% \subsection[\texttt{mode}]{\texttt{mode (\underline{osm}\textbar{}gm\textbar{}gsv})} +% \subsection{General options} +% \subsubsection[\texttt{mode}]{\texttt{mode (\underline{osm}\textbar{}gm\textbar{}gsv})} % This option sets the mode, that is the source of the images. OpenStreetMap, Google Maps or Google Street View! -% \subsection[\texttt{key}]{\texttt{key (\underline{Fmjtd\textbar{}luur20u22d,75=o5-9aylh6}})} +% \subsubsection[\texttt{inputencoding}]{\texttt{inputencoding}} +% This option specifies the input encoding of your file. +% The download script requires the strings encoded in utf8. +% For the safe conversion the input encoding of the file is required. +% Normally, you don't have to specify an encoding. +% The package tries to evaluate the encoding given to \package{inputenc} or assumes utf8. +% Usually that should work. +% \subsubsection[\texttt{overwrite}]{\texttt{overwrite (\underline{false}\textbar{}true)}} +% With this option, you can specify whether the image should be downloaded in any case. +% By default, the option is set to \texttt{false} in order to save bandwidth and compilation time. +% Nevertheless a check is performed on the existence of the image and the +% image will be downloaded, if it is not present. +% In the case of \texttt{true}, the image will be downloaded anyway! +% BTW, \texttt{overwrite} is equivalent to \texttt{overwrite=true}. +% \subsubsection[\texttt{file}]{\texttt{file (\underline{getmap})}} +% This \marginpar{\footnotesize\fbox{\parbox{3cm}{\raggedright{}changed default value to \texttt{getmap} in version 1.2!}}} +% option allows you to specify the name of the image (without extension). +% \subsection{\texttt{osm} mode} +% \subsubsection[\texttt{key}]{\texttt{key (\underline{Fmjtd\textbar{}luur20u22d,75=o5-9aylh6}})} % In \texttt{osm} mode, the download script requires a key in order to use the service of MapQuest. % By default, it uses a key, which is registered for \package{getmap}. % But you can register and use your own key with this option. @@ -932,70 +1010,236 @@ emph={}} % and store your own key there\footnote{Mapquest will deliver an url-encoded key, which must % be decoded to ASCII, e.g. by \href{http://urldecode.org/}{Url decode}}! % This file will be found after running \texttt{texhash}! -% \subsection[\texttt{scale}]{\texttt{scale (\underline{3385} (osm), \underline{1} (gm)})} -% \texttt{osm}: This option allows you to specify a display scale for the map image in the range of +% \subsubsection[\texttt{scale}]{\texttt{scale (\underline{3385}})} +% This option allows you to specify a display scale for the map image in the range of % 1692 -- 221871572. You will not necessarily see a difference between 5000 and 5500. % A scale value of 3385 corresponds to a zoom level of 17. -% -% \texttt{gm}: For the free version of Google Maps the image size is limited to 640x640. -% You can set \texttt{scale} to a value of 2, to get exactly the same map in doubled size in pixels. -% \subsection[\texttt{zoom}]{\texttt{zoom}} -% This option allows you to specify a zoom level in the range of 1 -- 18 -% ( osm - this option overwrites a possibly given scale) or 0 -- 21 (gm). -% \subsection[\texttt{xsize}]{\texttt{xsize (\underline{600})}} +% \subsubsection[\texttt{zoom}]{\texttt{zoom}} +% This option allows you to specify a zoom level in the range of 1 -- 18. +% This option overwrites a possibly given scale. +% \subsubsection[\texttt{xsize}]{\texttt{xsize (\underline{600})}} % This option specifies the width of the map in pixels. % If \marginpar{\footnotesize\fbox{\parbox{3cm}{\raggedright{}changed default value to \texttt{600} in version 1.2!}}} % you only want to slightly increase or decrease the map extract, % you should adjust the size of the map. You still have full control over the size of -% the map in the document with the options of \cmd\includegraphics. (max: 3840 (osm) or 640 (gm)) -% \subsection[\texttt{ysize}]{\texttt{ysize (\underline{400})}} -% This option specifies the height of the map in pixels. max: 3840 (osm) or 640 (gm)) -% \subsection[\texttt{file}]{\texttt{file (\underline{getmap})}} -% This \marginpar{\footnotesize\fbox{\parbox{3cm}{\raggedright{}changed default value to \texttt{getmap} in version 1.2!}}} -% option allows you to specify the name of the image (without extension). -% \subsection[\texttt{imagetype}]{\texttt{imagetype (\underline{png})}} +% the map in the document with the options of \cmd\includegraphics. (max: 3840) +% \subsubsection[\texttt{ysize}]{\texttt{ysize (\underline{400})}} +% This option specifies the height of the map in pixels. (max: 3840) +% \subsubsection[\texttt{imagetype}]{\texttt{imagetype (\underline{png}\textbar{}jpeg\textbar{}jpg\textbar{}gif)}} % This option allows you to specify the type of the image. -% -% \texttt{osm}: \texttt{\underline{png}\textbar{}jpeg\textbar{}jpg\textbar{}gif} -% -% \texttt{gm}: \texttt{\underline{png}\textbar{}png8\textbar{}png32\textbar{}gif\textbar{}jpg} (progressive)\texttt{\textbar{}jpg-baseline} (flat) -% \subsection[\texttt{type}]{\texttt{type (\underline{map} (osm)\textbar{}\underline{roadmap} (gm))}} +% \subsubsection[\texttt{type}]{\texttt{type (\underline{map}\textbar{}sat\textbar{}hyb)}} % This option specifies the type of the map. -% -% \texttt{osm}: \texttt{\underline{map}\textbar{}sat\textbar{}hyb} \quad\quad\ It seems as if there would be only a few regions of Mother Earth, +% It seems as if there would be only a few regions of Mother Earth, % for which satellite and hybrid images are available. +% \subsubsection[\texttt{color}]{\texttt{color (\underline{yellow\_1})}} +% This option specifies the color of the marker. Possible colors: % -% \texttt{gm}: \texttt{\underline{roadmap}\textbar{}satellite\textbar{}hybrid\textbar{}terrain} -% \subsection[\texttt{color}]{\texttt{color (\underline{yellow\_1}) (osm)\textbar{}\underline{blue} (gm))}} +% \href{http://open.mapquestapi.com/staticmap/icons.html}{http://open.mapquestapi.com/staticmap/icons.html} +% \subsubsection[\texttt{number}]{\texttt{number (\underline{1})}} +% This option specifies the number of the marker. +% \subsection{\texttt{gm} mode} +% \subsubsection[\texttt{scale}]{\texttt{scale (\underline{1})}} +% For the free version of Google Maps the image size is limited to 640x640. +% You can set \texttt{scale} to a value of 2, to get exactly the same map in doubled size in pixels. +% \subsubsection[\texttt{zoom}]{\texttt{zoom} (\underline{17})} +% This option allows you to specify a zoom level in the range of 0 -- 21. +% \subsubsection[\texttt{xsize}]{\texttt{xsize (\underline{600})}} +% This option specifies the width of the map in pixels. +% If you only want to slightly increase or decrease the map extract, +% you should adjust the size of the map. You still have full control over the size of +% the map in the document with the options of \cmd\includegraphics. (max: 640) +% \subsubsection[\texttt{ysize}]{\texttt{ysize (\underline{400})}} +% This option specifies the height of the map in pixels. (max: 640) +% \subsubsection[\texttt{imagetype}]{\texttt{imagetype (\underline{png}\textbar{}png8\textbar{} +% png32\textbar{}gif\textbar{}jpg} (progressive)\texttt{\textbar{}jpg-baseline} (flat))} +% This option allows you to specify the type of the image. +% \subsubsection[\texttt{type}]{\texttt{type (\underline{roadmap}\textbar{}satellite\textbar{}hybrid\textbar{}terrain)}} +% This option specifies the type of the map. +% \subsubsection[\texttt{color}]{\texttt{color (\underline{blue})}} % This option specifies the color of the marker. Possible colors: % -% \texttt{osm} \href{http://open.mapquestapi.com/staticmap/icons.html}{http://open.mapquestapi.com/staticmap/icons.html} +% black, brown, green, purple, yellow, blue, gray, orange, red, white or in hex format \texttt{0x3399FF} +% \subsubsection[\texttt{number}]{\texttt{number (\underline{1})}} +% This option specifies the number of the marker. Google Maps also allows uppercase letters: [A-Z]! +% \subsubsection[\texttt{language}]{\texttt{language} (\underline{en})} +% This option specifies the language of the map labels. +% Of course, not all languages are supported for all countries. +% At least, english and one of the national languages should be supported. +% Possible option values: en, de, fr, es, it, fi, ... +% \subsubsection{\texttt{markers}} +% This option allows you to set more than just the standard marker, which will no longer be used! +% You don't have to specify an address, as Google Maps will deliver an image with all markers on the map. +% Nevertheless, you can specify an address, which will define the center of the map. +% This option expects one or more URL parameters like: % -% \texttt{gm}: black, brown, green, purple, yellow, blue, gray, orange, red, white or in hex format \texttt{0x3399FF} -% \subsection[\texttt{number}]{\texttt{number (\underline{1})}} -% This option specifies the number of the marker. -% \subsection[\texttt{heading}]{\texttt{heading (\underline{0})}} -% This option specifies the heading (direction) in degrees in the range of 0 -- 360 (gsv mode). (0: north, 90: east, ...) -% \subsection[\texttt{pitch}]{\texttt{pitch (\underline{0})}} -% This option specifies the pitch (angle) of the camera view in degrees in the range of -90 -- 90 (gsv mode). -% \subsection[\texttt{fov}]{\texttt{fov (\underline{90})}} -% This option specifies the field of horizontal view (kind of zoom) in degrees in the range of 0 -- 120 (gsv mode). -% \subsection[\texttt{inputencoding}]{\texttt{inputencoding}} -% This option specifies the input encoding of your file. -% The download script requires the strings encoded in utf8. -% For the safe conversion the input encoding of the file is required. -% Normally, you don't have to specify an encoding. -% The package tries to evaluate the encoding given to \package{inputenc} or assumes utf8. -% Usually that should work. -% \subsection[\texttt{overwrite}]{\texttt{overwrite (\underline{false}\textbar{}true)}} -% With this option, you can specify whether the image should be downloaded in any case. -% By default, the option is set to \texttt{false} in order to save bandwidth and compilation time. -% Nevertheless a check is performed on the existence of the image and the -% image will be downloaded, if it is not present. -% In the case of \texttt{true}, the image will be downloaded anyway! -% BTW, \texttt{overwrite} is equivalent to \texttt{overwrite=true}. +% \texttt{\&markers=size:mid\textbar{}color:blue\textbar{}label:S\textbar{}loc1\textbar{}loc2\textbar{}...} +% +% \getmap[file=bmus1, mode=gm, +% markers={&markers=size:mid|label:B|color:green|Bode Museum, Berlin% +% &markers=label:P|color:green|Pergamonmuseum, Berlin% +% &markers=label:N|color:blue|Neues Museum, Berlin}% +% ]{} +% \includegraphics[width=10cm]{bmus1} +% \iffalse +%<*example> +% \fi +\begin{lstlisting} +\getmap[ +file=bmus1, mode=gm, +markers={&markers=size:mid|label:B|color:green|Bode Museum, Berlin% + &markers=label:P|color:green|Pergamonmuseum, Berlin% + &markers=label:N|color:blue|Neues Museum, Berlin}% +]{} +\includegraphics[width=10cm]{bmus1} +\end{lstlisting} +% \iffalse +% +% \fi +% The parameters size, color and label are optional! +% \begin{description} +% \item[size] tiny, \underline{mid}, small +% \item[color] \underline{red}, black, brown, green, purple, yellow, blue, gray, orange, white, 0x1188FF +% \item[label] [0-9][A-Z] (only in mid size!) +% \end{description} +% The default is a mid-sized red bubble with a black point! +% \subsubsection{\texttt{visible}} +% With this option you can specify a list of locations (separated by a pipe), which must be on the map! +% +% \getmap[file=bmus2, mode=gm, +% markers={&markers=size:mid|label:B|color:green|Bode Museum, Berlin +% &markers=label:P|color:green|Pergamonmuseum, Berlin +% &markers=label:N|color:blue|Neues Museum, Berlin}, +% visible={Brandenburger Tor, Berlin|Reichstagsufer 1, Berlin}]{} +% \includegraphics[width=10cm]{bmus2} +% \iffalse +%<*example> +% \fi +\begin{lstlisting} +\getmap[ +file=bmus2, mode=gm +markers={&markers=size:mid|label:B|color:green|Bode Museum, Berlin% + &markers=label:P|color:green|Pergamonmuseum, Berlin% + &markers=label:N|color:blue|Neues Museum, Berlin},% +visible={Brandenburger Tor, Berlin|Reichstagsufer 1, Berlin}]{} +\includegraphics[width=10cm]{bmus2} +\end{lstlisting} +% \iffalse +% +% \fi +% \subsubsection{\texttt{path}} +% With this option you can define one or more pathes! It expects one or more URL parameters like: +% +% \texttt{\&path=weight:5\textbar{}color:orange\textbar{}loc1\textbar{}loc2\textbar{}...} +% +% \iffalse +%<*example> +% \fi +\begin{lstlisting} +\getmap[file=bmus3, mode=gm, language=de, +markers={&markers=size:mid|label:B|color:green|Bode Museum, Berlin% + &markers=label:P|color:green|Pergamonmuseum, Berlin% + &markers=label:N|color:blue|Neues Museum, Berlin},% +path={&path=weight:5|color:orange|Bode Museum, Berlin|% + Pergamonmuseum, Berlin|Neues Museum, Berlin|% + James-Simon-Park,Berlin|52.522649,13.402523% + &path=weight:5|color:purple|James-Simon-Park, Berlin|% + Weinmeisterstraße 6, Berlin}]{} +\includegraphics[width=10cm]{bmus3} +\end{lstlisting} +% \iffalse +% +% \fi +% +% \getmap[file=bmus3, mode=gm, language=de, +% markers={&markers=size:mid|label:B|color:green|Bode Museum, Berlin% +% &markers=label:P|color:green|Pergamonmuseum, Berlin% +% &markers=label:N|color:blue|Neues Museum, Berlin},% +% path={&path=weight:5|color:orange|Bode Museum, Berlin|% +% Pergamonmuseum, Berlin|Neues Museum, Berlin|% +% James-Simon-Park,Berlin|52.522649,13.402523% +% &path=weight:5|color:purple|James-Simon-Park, Berlin|% +% Weinmeisterstraße 6, Berlin}]{} +% \includegraphics[width=10cm]{bmus3} +% +% You can also use \texttt{fillcolor} to mark areas! In pathes, you +% can also specify RGB32 colors, in which the last byte defines opacity, +% e.g. 55 (33\%). +% +% \getmap[file=cpny, mode=gm, zoom=13, +% path={&path=weight:2|color:orange|fillcolor:0xff641A55| +% 40.764302, -73.973004|40.768044, -73.981903|% +% 40.800642, -73.958193|40.796887, -73.949226|% +% 40.764302, -73.973004}]{Central Park, New York} +% \includegraphics[width=10cm]{cpny} +% \iffalse +%<*example> +% \fi +\begin{lstlisting} +\getmap[file=cpny, mode=gm, zoom=13, + path={&path=weight:2|color:orange|fillcolor:0xff641A55| + 40.764302, -73.973004|40.768044, -73.981903|% + 40.800642, -73.958193|40.796887, -73.949226|% + 40.764302, -73.973004}]{Central Park, New York} +\includegraphics[width=10cm]{cpny} +\end{lstlisting} +% \iffalse +% +% \fi +% +% With small enough spaces between way points you can also defines routes! +% The input of these would be very inconvenient. Therefore, Google Maps offers +% an online interactive map tool\footnote{\href{https://developers.google.com/maps/documentation/utilities/polylineutility}{https://developers.google.com/maps/documentation/utilities/polylineutility}}! +% Simply use \texttt{enc:polyline\_data} as location specifier. +% This string can contain all sorts of troublesome characters for \LaTeX{}. +% \cmd\getmap\ can deal with them, with the exception of curly braces! +% These will break your \LaTeX{} document. As a work-around, use the \texttt{pathfile} option. +% \subsubsection{\texttt{pathfile}} +% This option specifies the file holding the path specification. It will be loaded by the \texttt{Lua} script. +% You can use the \env{filecontents*} environment to keep the definition in your document. +% It should be a one line utf8-encoded file! +% +% \begin{filecontents*}{muc.epl} +% &path=weight:5|color:orange|enc:okydHa}peAXOHi@jANv@A@kJJmFAiDJuAHmDXcBb@cC`@gC^_DV}CJaCF{APaBVkBdAyEf@qC`@{B\aDSwB +% \end{filecontents*} +% \getmap[file=muc, mode=gm, +% markers={&markers=size:mid|label:H|color:green|München, Hbf +% &markers=label:S|color:yellow|Stachus, München +% &markers=label:M|color:blue|Marienplatz, München}, +% pathfile={muc.epl}]{} +%\includegraphics[width=10cm]{muc} +% \iffalse +%<*example> +% \fi +\begin{lstlisting} +\begin{filecontents*}{muc.epl} +&path=weight:5|color:orange|enc:okydHa}peAXOHi@jANv@A@kJJmFAi% +DJuAHmDXcBb@cC`@gC^_DV}CJaCF{APaBVkBdAyEf@qC`@{B\aDSwB +\end{filecontents*} +\getmap[file=muc, mode=gm, +markers={&markers=size:mid|label:H|color:green|München, Hbf + &markers=label:S|color:yellow|Stachus, München + &markers=label:M|color:blue|Marienplatz, München}, +pathfile={muc.epl}]{} +\includegraphics[width=10cm]{muc} +\end{lstlisting} +% \iffalse +% +% \fi +% +% \subsection{\texttt{gsv} mode} +% \subsubsection[\texttt{xsize}]{\texttt{xsize (\underline{600})}} +% This option specifies the width of the map in pixels. (max: 640) +% \subsubsection[\texttt{ysize}]{\texttt{ysize (\underline{400})}} +% This option specifies the height of the map in pixels. (max: 640) +% \subsubsection[\texttt{heading}]{\texttt{heading (\underline{0})}} +% This option specifies the heading (direction) in degrees in the range of 0 -- 360. (0: north, 90: east, ...) +% \subsubsection[\texttt{pitch}]{\texttt{pitch (\underline{0})}} +% This option specifies the pitch (angle) of the camera view in degrees in the range of -90 -- 90. +% \subsubsection[\texttt{fov}]{\texttt{fov (\underline{90})}} +% This option specifies the field of horizontal view (kind of zoom) in degrees in the range of 0 -- 120. +% \clearpage % \section{Command(s)} -% \subsection{\cmd\getmap} +% \subsection[\textbackslash{}getmap]{\cmd\getmap} % With the \cmd\getmap\ command\margcs{\cmd\getmap\oarg{options}\marg{address}} you can download % a map, if you enable \cmd\write18 (TeXLive: \texttt{-shell-escape}, MiKTeX: \texttt{-{}-enable-write18}). % This is only necessary if you actually download an image. @@ -1122,13 +1366,14 @@ emph={}} % \changes{v1.2}{2014/07/11}{added support for Google Maps} % \changes{v1.2}{2014/07/11}{renamed osmimage.lua to getmapdl.lua} % \changes{v1.3}{2014/07/19}{added support for Google Street View} +% \changes{v1.4}{2014/07/25}{added options language, markers, visible, path and pathfile in gm mode} % \begin{macrocode} %<*package> % \end{macrocode} % First, we provide the \LaTeX\ package \package{getmap}. % \begin{macrocode} \NeedsTeXFormat{LaTeX2e}% -\ProvidesPackage{getmap}[2014/07/19 v1.3 getmap.sty - Josef Kleber (C) 2014]% +\ProvidesPackage{getmap}[2014/07/25 v1.4 getmap.sty - Josef Kleber (C) 2014]% % \end{macrocode} % We need a few packages! % \begin{macrocode} @@ -1152,6 +1397,18 @@ emph={}} \expandafter\def\csname#1@#3\endcsname{##1}% }% }% +\newcommand*\GM@JK@define@key@detok[4]% +{% + \expandafter\gdef\csname#1@#3\endcsname{#4}% + \define@key{#2.sty}{#3}[#4]% + {% + \expandafter\gdef\csname#1@#3\endcsname{\detokenize{##1}}% + }% + \define@key{#2}{#3}% + {% + \expandafter\def\csname#1@#3\endcsname{\detokenize{##1}}% + }% +}% % \end{macrocode} % Now, we can use this macro to define our options. % \changes{v1.2}{2014/07/11}{changed default values of \texttt{xsize }(600) and \texttt{file} (getmap)} @@ -1169,6 +1426,11 @@ emph={}} \GM@JK@define@key{GM@JK}{getmap}{heading}{0}% \GM@JK@define@key{GM@JK}{getmap}{fov}{90}% \GM@JK@define@key{GM@JK}{getmap}{pitch}{0}% +\GM@JK@define@key{GM@JK}{getmap}{language}{en}% +\GM@JK@define@key@detok{GM@JK}{getmap}{markers}{}% +\GM@JK@define@key@detok{GM@JK}{getmap}{path}{}% +\GM@JK@define@key@detok{GM@JK}{getmap}{visible}{}% +\GM@JK@define@key{GM@JK}{getmap}{pathfile}{}% \GM@JK@define@key{GM@JK}{getmap}{file}{getmap}% \GM@JK@define@key{GM@JK}{getmap}{inputencoding}{}% \GM@JK@define@key{GM@JK}{getmap}{overwrite}{true}% @@ -1211,7 +1473,7 @@ emph={}} % \end{macrocode} % We execute the package options to define and set the option macros. % \begin{macrocode} -\ExecuteOptionsX{mode,xsize,ysize,scale,zoom,type,imagetype,color,number,file,heading,fov,pitch}% +\ExecuteOptionsX{mode,xsize,ysize,scale,zoom,type,imagetype,color,number,file,heading,fov,pitch,language}% % \ProcessOptionsX\relax% % @@ -1289,6 +1551,12 @@ emph={}} \space-i\space \GM@JK@imagetype% \space-c\space "\GM@JK@color"% \space-n\space \GM@JK@number% + \space-L\space "\GM@JK@language"% + \space-M\space "\GM@JK@markers@string"% + \space-C\space "\GM@JK@location@string"% + \space-P\space "\GM@JK@path@string"% + \space-p\space "\GM@JK@pathfile"% + \space-V\space "\GM@JK@visible@string"% \space-o\space \GM@JK@file}% }% {% @@ -1374,6 +1642,39 @@ emph={}} {% failure \errmessage{Converting to UTF-8 failed}% }% + \StringEncodingConvert% + {\GM@JK@markers@string}% + {\GM@JK@markers}% + {\GM@JK@inputencoding}{utf-8}% + \StringEncodingSuccessFailure% + {% + %success + }% + {% failure + \errmessage{Converting to UTF-8 failed}% + }% + \StringEncodingConvert% + {\GM@JK@path@string}% + {\GM@JK@path}% + {\GM@JK@inputencoding}{utf-8}% + \StringEncodingSuccessFailure% + {% + %success + }% + {% failure + \errmessage{Converting to UTF-8 failed}% + }% + \StringEncodingConvert% + {\GM@JK@visible@string}% + {\GM@JK@visible}% + {\GM@JK@inputencoding}{utf-8}% + \StringEncodingSuccessFailure% + {% + %success + }% + {% failure + \errmessage{Converting to UTF-8 failed}% + }% % \end{macrocode} % We check, if \styleoption{overwrite} is \texttt{true} and download the map. % If not, we check if the image is already in the working directory. If not, we diff --git a/Master/texmf-dist/doc/latex/getmap/getmap.pdf b/Master/texmf-dist/doc/latex/getmap/getmap.pdf index d0112ad6585..ebcc99dd173 100644 Binary files a/Master/texmf-dist/doc/latex/getmap/getmap.pdf and b/Master/texmf-dist/doc/latex/getmap/getmap.pdf differ diff --git a/Master/texmf-dist/doc/latex/getmap/install.bat b/Master/texmf-dist/doc/latex/getmap/install.bat index 187fe0cb5e4..d9c5fb9092e 100755 --- a/Master/texmf-dist/doc/latex/getmap/install.bat +++ b/Master/texmf-dist/doc/latex/getmap/install.bat @@ -53,6 +53,7 @@ del *.toc del *.txt del *.png del *.jpg +del *.epl del getmapdl.lua del README del getmap.pdf diff --git a/Master/texmf-dist/doc/latex/getmap/makefile b/Master/texmf-dist/doc/latex/getmap/makefile index 632f43676c6..322429c3e0d 100644 --- a/Master/texmf-dist/doc/latex/getmap/makefile +++ b/Master/texmf-dist/doc/latex/getmap/makefile @@ -59,7 +59,7 @@ ctan: clean: $(RM) *.aux *.fdb_latexmk *.fls *.ind *.idx *.ilg *.glo *.gls \ *.log *.lol *.m *.out *.tmp *.toc *.sh *.hd \ - *.bbl *.blg *.ins *.txt *.bib + *.bbl *.blg *.ins *.txt *.bib *.epl cleanall: clean $(RM) getmapdl.lua *.sty *.png *.jpg\ diff --git a/Master/texmf-dist/doc/latex/getmap/manifest.txt b/Master/texmf-dist/doc/latex/getmap/manifest.txt index be74e3cefe9..b7f6f9043b6 100644 --- a/Master/texmf-dist/doc/latex/getmap/manifest.txt +++ b/Master/texmf-dist/doc/latex/getmap/manifest.txt @@ -12,3 +12,4 @@ getmap.sty getmap.cfg getmap-example.tex getmapdl.lua +manifest.txt diff --git a/Master/texmf-dist/scripts/getmap/getmapdl.lua b/Master/texmf-dist/scripts/getmap/getmapdl.lua index e3611a928ca..77d2890cee0 100755 --- a/Master/texmf-dist/scripts/getmap/getmapdl.lua +++ b/Master/texmf-dist/scripts/getmap/getmapdl.lua @@ -2,7 +2,7 @@ -- -- getmapdl [options] -- --- downloads an OpenStreetMap or Google Maps map specified by [options] +-- downloads an OpenStreetMap, Google Maps or Google Street View map specified by [options] -- -- License: LPPL -- @@ -28,13 +28,15 @@ local COLOR = "" local NUMBER = "" local VISIBLE = "" local IPATH = "" +local FPATH = "" local MARKERS = "" local HEADING = "" local FOV = "" local PITCH = "" +local LANGUAGE = "" local OFILE = "getmap" local QUIET = "false" -local VERSION = "v1.1 (19/07/2014)" +local VERSION = "v1.2 (25/07/2014)" function pversion() print("getmapdl.lua " .. VERSION) @@ -61,7 +63,7 @@ getmapdl.lua [options] -S short form to specify a size, e.g. 600,400 (osm) or 600x400 (gm) - -s specify a scale factor in the range 1692-221871572 (osmm) or + -s specify a scale factor in the range 1692-221871572 (osm) or 1-2 (osm) -z specify a zoom in the range 1-18 (osm) or 0-21 (17) (gm) @@ -88,6 +90,8 @@ getmapdl.lua [options] gm mode only: + -L specify the language of map labels (xx language code (en,de,fr,...)) + -M specify markers; see: https://developers.google.com/maps/documentation/staticmaps/index#Markers e.g.: &markers=size:mid|color:blue|label:1|address or more of these @@ -100,6 +104,9 @@ getmapdl.lua [options] -P specify path from location to location e.g.: &path=weight:7|color:purple|loc1|loc2 + -p specify a file holding the path specification + (maybe needed for encoded polylines) + gsv mode only: -H specify heading (view) (0) (0 -- 360) (east: 90, ...) @@ -179,6 +186,9 @@ do elseif arg[i] == "-n" then NUMBER = arg[i+1] i = i + 1 + elseif arg[i] == "-L" then + LANGUAGE = arg[i+1] + i = i + 1 elseif arg[i] == "-M" then MARKERS = arg[i+1] i = i + 1 @@ -197,6 +207,9 @@ do elseif arg[i] == "-P" then IPATH = arg[i+1] i = i + 1 + elseif arg[i] == "-p" then + FPATH = arg[i+1] + i = i + 1 elseif arg[i] == "-o" then OFILE = arg[i+1] i = i + 1 @@ -360,9 +373,12 @@ local USHOWICON = "" local UIMAGETYPE = "" local UVISIBLE = "" local UIPATH = "" +local UFPATH = "" +local EPLFILE = "" local UHEADING = "" local UFOV = "" local UPITCH = "" +local ULANGUAGE = "" local UOFILE = "" local IMGURL = "" @@ -401,8 +417,23 @@ if MODE == "gm" then -- correct cruft escaping of "&path=" UIPATH = UIPATH:gsub("%%26path%%3d","&path=") end + if FPATH == "" then + UFPATH = "" + else + EPLFILE = io.open(FPATH, "r") + local contents = EPLFILE:read() + EPLFILE:close() + UFPATH = "" .. url.escape(contents) + -- correct cruft escaping of "&path=" + UFPATH = UFPATH:gsub("%%26path%%3d","&path=") + end + if LANGUAGE == "" then + ULANGUAGE="" + else + ULANGUAGE="&language=" .. LANGUAGE + end UOFILE = OFILE .. "." .. IMAGETYPE - IMGURL = GMURL .. "?" .. ULOCATION .. USIZE .. UZOOM .. UMARKERS .. UTYPE .. USCALE .. UIMAGETYPE .. UVISIBLE .. UIPATH .. "&sensor=false" + IMGURL = GMURL .. "?" .. ULOCATION .. USIZE .. UZOOM .. UMARKERS .. UTYPE .. USCALE .. UIMAGETYPE .. UVISIBLE .. UIPATH .. UFPATH .. ULANGUAGE .. "&sensor=false" elseif MODE == "gsv" then ULOCATION = "location=" .. url.escape(LOCATION) USIZE = "&size=" .. url.escape(SIZE) diff --git a/Master/texmf-dist/tex/latex/getmap/getmap.sty b/Master/texmf-dist/tex/latex/getmap/getmap.sty index 424f14ea8e7..977db82ab20 100644 --- a/Master/texmf-dist/tex/latex/getmap/getmap.sty +++ b/Master/texmf-dist/tex/latex/getmap/getmap.sty @@ -27,7 +27,7 @@ %% This work consists of all files listed in manifest.txt. %% \NeedsTeXFormat{LaTeX2e}% -\ProvidesPackage{getmap}[2014/07/19 v1.3 getmap.sty - Josef Kleber (C) 2014]% +\ProvidesPackage{getmap}[2014/07/25 v1.4 getmap.sty - Josef Kleber (C) 2014]% \RequirePackage{xkeyval}% \RequirePackage{stringenc}% \RequirePackage{ifthen}% @@ -43,6 +43,18 @@ \expandafter\def\csname#1@#3\endcsname{##1}% }% }% +\newcommand*\GM@JK@define@key@detok[4]% +{% + \expandafter\gdef\csname#1@#3\endcsname{#4}% + \define@key{#2.sty}{#3}[#4]% + {% + \expandafter\gdef\csname#1@#3\endcsname{\detokenize{##1}}% + }% + \define@key{#2}{#3}% + {% + \expandafter\def\csname#1@#3\endcsname{\detokenize{##1}}% + }% +}% \GM@JK@define@key{GM@JK}{getmap}{mode}{osm}% \GM@JK@define@key{GM@JK}{getmap}{key}{}% \GM@JK@define@key{GM@JK}{getmap}{xsize}{600}% @@ -56,6 +68,11 @@ \GM@JK@define@key{GM@JK}{getmap}{heading}{0}% \GM@JK@define@key{GM@JK}{getmap}{fov}{90}% \GM@JK@define@key{GM@JK}{getmap}{pitch}{0}% +\GM@JK@define@key{GM@JK}{getmap}{language}{en}% +\GM@JK@define@key@detok{GM@JK}{getmap}{markers}{}% +\GM@JK@define@key@detok{GM@JK}{getmap}{path}{}% +\GM@JK@define@key@detok{GM@JK}{getmap}{visible}{}% +\GM@JK@define@key{GM@JK}{getmap}{pathfile}{}% \GM@JK@define@key{GM@JK}{getmap}{file}{getmap}% \GM@JK@define@key{GM@JK}{getmap}{inputencoding}{}% \GM@JK@define@key{GM@JK}{getmap}{overwrite}{true}% @@ -76,7 +93,7 @@ \gdef\GM@JK@inputencoding{utf8}% }% \newif\ifGM@JK@writexviii\GM@JK@writexviiifalse% -\ExecuteOptionsX{mode,xsize,ysize,scale,zoom,type,imagetype,color,number,file,heading,fov,pitch}% +\ExecuteOptionsX{mode,xsize,ysize,scale,zoom,type,imagetype,color,number,file,heading,fov,pitch,language}% \ProcessOptionsX\relax% \ifthenelse{\equal{\GM@JK@mode}{gm}}% {% @@ -132,6 +149,12 @@ \space-i\space \GM@JK@imagetype% \space-c\space "\GM@JK@color"% \space-n\space \GM@JK@number% + \space-L\space "\GM@JK@language"% + \space-M\space "\GM@JK@markers@string"% + \space-C\space "\GM@JK@location@string"% + \space-P\space "\GM@JK@path@string"% + \space-p\space "\GM@JK@pathfile"% + \space-V\space "\GM@JK@visible@string"% \space-o\space \GM@JK@file}% }% {% @@ -197,6 +220,39 @@ {% failure \errmessage{Converting to UTF-8 failed}% }% + \StringEncodingConvert% + {\GM@JK@markers@string}% + {\GM@JK@markers}% + {\GM@JK@inputencoding}{utf-8}% + \StringEncodingSuccessFailure% + {% + %success + }% + {% failure + \errmessage{Converting to UTF-8 failed}% + }% + \StringEncodingConvert% + {\GM@JK@path@string}% + {\GM@JK@path}% + {\GM@JK@inputencoding}{utf-8}% + \StringEncodingSuccessFailure% + {% + %success + }% + {% failure + \errmessage{Converting to UTF-8 failed}% + }% + \StringEncodingConvert% + {\GM@JK@visible@string}% + {\GM@JK@visible}% + {\GM@JK@inputencoding}{utf-8}% + \StringEncodingSuccessFailure% + {% + %success + }% + {% failure + \errmessage{Converting to UTF-8 failed}% + }% \ifthenelse{\equal{\GM@JK@overwrite}{true}}% {% \GM@JK@shellescape% -- cgit v1.2.3