From 9790eead4cceaffc951c93887d06de70c02e196a Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Sun, 20 Jul 2014 22:13:12 +0000 Subject: getmap (20jul14) git-svn-id: svn://tug.org/texlive/trunk@34670 c570f23f-e606-0410-a88d-b1316a301751 --- Master/texmf-dist/doc/latex/getmap/README | 30 ++-- Master/texmf-dist/doc/latex/getmap/getmap.dtx | 239 +++++++++++++++++++------ Master/texmf-dist/doc/latex/getmap/getmap.pdf | Bin 1288925 -> 1379860 bytes Master/texmf-dist/doc/latex/getmap/install.bat | 2 + Master/texmf-dist/doc/latex/getmap/makefile | 2 +- Master/texmf-dist/scripts/getmap/getmapdl.lua | 80 ++++++++- Master/texmf-dist/tex/latex/getmap/getmap.sty | 50 ++++-- 7 files changed, 306 insertions(+), 97 deletions(-) (limited to 'Master') diff --git a/Master/texmf-dist/doc/latex/getmap/README b/Master/texmf-dist/doc/latex/getmap/README index ff8daf21794..ef0789ff1ec 100644 --- a/Master/texmf-dist/doc/latex/getmap/README +++ b/Master/texmf-dist/doc/latex/getmap/README @@ -1,31 +1,21 @@ The goal of this package is the simplest possible provision of -map images (OpenStreetMap and Google Maps are supported). In the -simplest case, the specification of an address is sufficient. -The package loads the map using the \write18 feature, which you -must activate to use this package. The image will be downloaded -by an external Lua script. You can use this script, as well as -the attached bash script also from the command line. +map images (OpenStreetMap, Google Maps and Google Street View +are supported). In the simplest case, the specification of an +address is sufficient. The package loads the map using the +\write18 feature, which you must activate to use this package. +The image will be downloaded by an external Lua script. You can +use this script also from the command line. License: LPPL -Changes in v1.2: +Changes in v1.3: -- added support for Google Maps +- added support for Google Street View - * new option mode - * renamed osmimage.lua -> getmapdl.lua - * changed defaults for xsize (600) and file (getmap) - * broader support of satellite and hybrid images - * new map type terrain - * much smaller files for maps - (less details like house numbers) + * new options heading, pitch, fov - added more examples to the documentation -- added getmap.cfg to store default key (osm) - - feature request by: Ulrike Fischer - INSTALL =========== @@ -52,7 +42,7 @@ download getmap.dtx and makefile (Linux) or install.bat (Windows) * Windows - In MiKTeX scripts like osmimage.lua must be registered. + In MiKTeX scripts like getmapdl.lua must be registered. This can not be done manually! Please use the package manager to install getmap. diff --git a/Master/texmf-dist/doc/latex/getmap/getmap.dtx b/Master/texmf-dist/doc/latex/getmap/getmap.dtx index c76b98c7db5..d429d1e91e1 100644 --- a/Master/texmf-dist/doc/latex/getmap/getmap.dtx +++ b/Master/texmf-dist/doc/latex/getmap/getmap.dtx @@ -5,32 +5,22 @@ % %<*readme> The goal of this package is the simplest possible provision of -map images (OpenStreetMap and Google Maps are supported). In the -simplest case, the specification of an address is sufficient. -The package loads the map using the \write18 feature, which you -must activate to use this package. The image will be downloaded -by an external Lua script. You can use this script, as well as -the attached bash script also from the command line. +map images (OpenStreetMap, Google Maps and Google Street View +are supported). In the simplest case, the specification of an +address is sufficient. The package loads the map using the +\write18 feature, which you must activate to use this package. +The image will be downloaded by an external Lua script. You can +use this script also from the command line. License: LPPL -Changes in v1.2: +Changes in v1.3: -- added support for Google Maps +- added support for Google Street View - * new option mode - * renamed osmimage.lua -> getmapdl.lua - * changed defaults for xsize (600) and file (getmap) - * broader support of satellite and hybrid images - * new map type terrain - * much smaller files for maps - (less details like house numbers) + * new options heading, pitch, fov - added more examples to the documentation - -- added getmap.cfg to store default key (osm) - - feature request by: Ulrike Fischer INSTALL @@ -59,7 +49,7 @@ download getmap.dtx and makefile (Linux) or install.bat (Windows) * Windows - In MiKTeX scripts like osmimage.lua must be registered. + In MiKTeX scripts like getmapdl.lua must be registered. This can not be done manually! Please use the package manager to install getmap. @@ -104,6 +94,13 @@ download getmap.dtx and makefile (Linux) or install.bat (Windows) year = {2014}, } +@misc{bib:googlesvapi, + author = {{Google, Inc.}}, + note = {\href{https://developers.google.com/maps/documentation/streetview/index}{https://developers.google.com/maps/documentation/streetview/index}}, + title = {{Google Street View Image API}}, + year = {2014}, + } + % %<*luafile> #!/usr/bin/env texlua @@ -120,6 +117,7 @@ local url = require("socket.url") local OSMURL = "http://open.mapquestapi.com/staticmap/v4/getplacemap" local GMURL = "http://maps.googleapis.com/maps/api/staticmap" +local GSVURL = "http://maps.googleapis.com/maps/api/streetview" local KEY = "" local MODE = "" local LOCATION = "" @@ -136,9 +134,12 @@ local NUMBER = "" local VISIBLE = "" local IPATH = "" local MARKERS = "" +local HEADING = "" +local FOV = "" +local PITCH = "" local OFILE = "getmap" local QUIET = "false" -local VERSION = "v1.0 (15/07/2014)" +local VERSION = "v1.1 (19/07/2014)" function pversion() print("getmapdl.lua " .. VERSION) @@ -204,6 +205,14 @@ getmapdl.lua [options] -P specify path from location to location e.g.: &path=weight:7|color:purple|loc1|loc2 + gsv mode only: + + -H specify heading (view) (0) (0 -- 360) (east: 90, ...) + + -T specify the pitch (angle) (0) (-90 -- 90) + + -F specify horizontal field of view (90) (0 -- 120) + The field of view is expressed in degrees and a kind of zoom! ]]) pversion() end @@ -218,8 +227,7 @@ function getmap_warning(warningtext) end function check_number(var, varname) - local number='^[0-9]+$' - if not(string.match(var, '^[0-9]+$')) then + if not(string.match(var, '^[-]?[0-9]+$')) then getmap_error(2, varname .. " can't be " .. var .. "! Not a number!") end end @@ -231,6 +239,8 @@ function check_range(var,min,max,exitcode,varname) end end +print("\n") + do local newarg = {} local i, limit = 1, #arg @@ -277,6 +287,15 @@ do elseif arg[i] == "-M" then MARKERS = arg[i+1] i = i + 1 + elseif arg[i] == "-H" then + HEADING = arg[i+1] + i = i + 1 + elseif arg[i] == "-T" then + PITCH = arg[i+1] + i = i + 1 + elseif arg[i] == "-F" then + FOV = arg[i+1] + i = i + 1 elseif arg[i] == "-V" then VISIBLE = arg[i+1] i = i + 1 @@ -336,6 +355,8 @@ end if SIZE == "" then if MODE == "gm" then SIZE = XSIZE .. "x" .. YSIZE + elseif MODE == "gsv" then + SIZE = XSIZE .. "x" .. YSIZE elseif MODE == "osm" then SIZE = XSIZE .. "," .. YSIZE end @@ -364,8 +385,11 @@ if TYPE == "" then end if IMAGETYPE == "" then - IMAGETYPE="png" - getmap_warning("IMAGETYPE not specified; using png as default!") + if MODE == "gsv" then + else + IMAGETYPE="png" + getmap_warning("IMAGETYPE not specified; using png as default!") + end end if COLOR == "" then @@ -379,8 +403,28 @@ if COLOR == "" then end if NUMBER == "" then - NUMBER=1 - getmap_warning("NUMBER not specified; using 1 as default!") + if MODE == "gsv" then + else + NUMBER=1 + getmap_warning("NUMBER not specified; using 1 as default!") + end +end + +if MODE == "gsv" then + if HEADING == "" then + HEADING=0 + getmap_warning("HEADING not specified; using 0 as default!") + end + + if FOV == "" then + FOV=90 + getmap_warning("FOV not specified; using 90 as default!") + end + + if PITCH == "" then + PITCH=0 + getmap_warning("PITCH not specified; using 0 as default!") + end end if MODE == "gm" then @@ -392,6 +436,12 @@ if MODE == "gm" then check_range(XSIZE,1,640,12,"XSIZE") check_range(YSIZE,1,640,13,"YSIZE") check_range(SCALE,1,2,14,"SCALE") +elseif MODE == "gsv" then + check_range(XSIZE,1,640,12,"XSIZE") + check_range(YSIZE,1,640,13,"YSIZE") + check_range(HEADING,0,360,15,"HEADING") + check_range(FOV,0,120,16,"FOV") + check_range(PITCH,-90,90,17,"PITCH") elseif MODE == "osm" then check_range(XSIZE,1,3840,11,"XSIZE") check_range(YSIZE,1,3840,12,"YSIZE") @@ -415,6 +465,9 @@ local USHOWICON = "" local UIMAGETYPE = "" local UVISIBLE = "" local UIPATH = "" +local UHEADING = "" +local UFOV = "" +local UPITCH = "" local UOFILE = "" local IMGURL = "" @@ -455,6 +508,14 @@ if MODE == "gm" then end UOFILE = OFILE .. "." .. IMAGETYPE IMGURL = GMURL .. "?" .. ULOCATION .. USIZE .. UZOOM .. UMARKERS .. UTYPE .. USCALE .. UIMAGETYPE .. UVISIBLE .. UIPATH .. "&sensor=false" +elseif MODE == "gsv" then + ULOCATION = "location=" .. url.escape(LOCATION) + USIZE = "&size=" .. url.escape(SIZE) + UHEADING = "&heading=" .. url.escape(HEADING) + UFOV = "&fov=" .. url.escape(FOV) + UPITCH = "&pitch=" .. url.escape(PITCH) + UOFILE = OFILE .. ".jpg" + IMGURL = GSVURL .. "?" .. ULOCATION .. USIZE .. UHEADING .. UFOV .. UPITCH .. "&sensor=false" elseif MODE == "osm" then UKEY = "?key=" .. url.escape(KEY) ULOCATION = "&location=" .. url.escape(LOCATION) @@ -477,7 +538,7 @@ ofile, msg = io.open(UOFILE, "wb") if not ofile then getmap_error(21, msg) end -print("\n\ngetmap.lua:") +print("\n\ngetmapdl.lua:") print("url = " .. IMGURL) print("output = " .. UOFILE) ret, msg = http.request{ @@ -678,9 +739,9 @@ emph={}} {\parbox{15cm}{\huge\sffamily\textbf{\@fileversion}}};% \draw[anchor=west,yshift=-9cm,xshift=3cm,color=NavyBlue] (0,0) node% {\parbox{15cm}{\RaggedRight\huge\sffamily\textbf{\@subtitle}}};% - \draw[anchor=west,yshift=-13cm,xshift=3cm,color=NavyBlue] (0,0) node% + \draw[anchor=west,yshift=-14cm,xshift=3cm,color=NavyBlue] (0,0) node% {\includegraphics[width=8cm]{getmap}};% - \draw[anchor=west,yshift=-17cm,xshift=3cm,color=NavyBlue] (0,0) node% + \draw[anchor=west,yshift=-18cm,xshift=3cm,color=NavyBlue] (0,0) node% {\parbox{15cm}{\huge\sffamily\textbf{\@date}}};% \draw[anchor=west,yshift=-20cm,xshift=3cm,color=NavyBlue] (0,0) node% {\parbox{15cm}{\Large\sffamily{\@authorline\\\textbf{\@author}}}};% @@ -802,12 +863,12 @@ emph={}} % % \fi % -% \getmap{Bergheimer Straße 110A, 69115 Heidelberg, Germany} +%\getmap{Bergheimer Straße 110A, 69115 Heidelberg, Germany} %\GetFileInfo{\jobname.sty} -%\hypersetup{pdfauthor={Josef Kleber},pdftitle={Downloading maps from OpenStreetMap or Google Maps},pdfsubject={Documentation for LaTeX style \filename},pageanchor=true,hyperindex=true}% +%\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},emphstyle={[2]\color{OliveDrab}}, +%emph={[2]width,xsize,ysize,zoom,scale,mode,file,type,heading,pitch,fov},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, @@ -816,7 +877,7 @@ emph={}} % % \bibliographystyle{plain} % \title{\filename}% -% \Subtitle{Downloading maps from OpenStreetMap or Google Maps}% +% \Subtitle{Downloading maps from OpenStreetMap, Google Maps or Google Street View}% % \author{Josef Kleber} % \Fileversion{\fileversion} % \date{\filedate} @@ -843,12 +904,12 @@ emph={}} % \Headline{Abstract} % \begin{abstract} % The goal of this package is the simplest possible provision of -% map images (OpenStreetMap and Google Maps are supported). -% In the simplest case, the specification of an address is sufficient. -% The package loads the map using the \cmd\write18 feature, which you -% must activate to use this package. The image will be downloaded -% by an external Lua script. You can use this script, as well as -% the attached bash script also from the command line. +% map images (OpenStreetMap, Google Maps and Google Street View +% are supported). In the simplest case, the specification of an +% address is sufficient. The package loads the map using the +% \cmd\write18 feature, which you must activate to use this package. +% The image will be downloaded by an external Lua script. You can +% use this script also from the command line. % \end{abstract} % \vfill % \renewcommand*{\abstractname}{Acknowledgment} @@ -861,8 +922,8 @@ 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})} -% This option sets the mode, that is the source of the images. OpenStreetMap or Google Maps! +% \subsection[\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}})} % 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}. @@ -913,6 +974,12 @@ emph={}} % \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. @@ -953,6 +1020,7 @@ emph={}} % % \fi % +% \clearpage % \section{Examples}\marginnote{\attachfile[author={Josef Kleber},subject={getmap-example.tex},description={getmap-example.tex (source example)} ,mimetype={text/plain}, icon={Tag}]{getmap-example.tex}} % % The same map as before from Google Maps: @@ -1018,17 +1086,49 @@ emph={}} % % \fi % \clearpage +% Street View now: +% +% \getmap[file=parisgsv,mode=gsv,heading=320,pitch=30,fov=40,xsize=300,ysize=600]{Avenue Piere-Loti, Paris} +% \includegraphics[width=4cm]{parisgsv} +% \iffalse +%<*example> +% \fi +\begin{lstlisting} + \getmap[file=parisgsv,mode=gsv,heading=320,pitch=30,fov=40,% + xsize=300,ysize=600]{Avenue Piere-Loti, Paris} + \includegraphics[width=4cm]{parisgsv} +\end{lstlisting} +% \iffalse +% +% \fi +% and from the platform: +% +% \getmap[file=parisgsvp,mode=gsv,heading=30,pitch=-25,fov=60]{Tour Eiffel, Paris} +% \includegraphics[width=8cm]{parisgsvp} +% \iffalse +%<*example> +% \fi +\begin{lstlisting} + \getmap[file=parisgsvp,mode=gsv,heading=30,pitch=-25,fov=60]% + {Tour Eiffel, Paris} + \includegraphics[width=8cm]{parisgsvp} +\end{lstlisting} +% \iffalse +% +% \fi +% \clearpage % \section{Implementation} % \changes{v1.0}{2014/05/25}{CTAN upload} % \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} % \begin{macrocode} %<*package> % \end{macrocode} % First, we provide the \LaTeX\ package \package{getmap}. % \begin{macrocode} \NeedsTeXFormat{LaTeX2e}% -\ProvidesPackage{getmap}[2014/07/15 v1.2 getmap.sty - Josef Kleber (C) 2014]% +\ProvidesPackage{getmap}[2014/07/19 v1.3 getmap.sty - Josef Kleber (C) 2014]% % \end{macrocode} % We need a few packages! % \begin{macrocode} @@ -1066,6 +1166,9 @@ emph={}} \GM@JK@define@key{GM@JK}{getmap}{imagetype}{png}% \GM@JK@define@key{GM@JK}{getmap}{color}{yellow_1}% \GM@JK@define@key{GM@JK}{getmap}{number}{1}% +\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}{file}{getmap}% \GM@JK@define@key{GM@JK}{getmap}{inputencoding}{}% \GM@JK@define@key{GM@JK}{getmap}{overwrite}{true}% @@ -1108,7 +1211,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}% +\ExecuteOptionsX{mode,xsize,ysize,scale,zoom,type,imagetype,color,number,file,heading,fov,pitch}% % \ProcessOptionsX\relax% % @@ -1174,17 +1277,36 @@ emph={}} \space-o\space \GM@JK@file}% }% {% - \immediate\write18{getmapdl \space-l\space "\GM@JK@location@string"% - \space-m\space gm% - \space-x\space \GM@JK@xsize% - \space-y\space \GM@JK@ysize% - \space-z\space \GM@JK@zoom% - \space-s\space \GM@JK@scale% - \space-t\space \GM@JK@type% - \space-i\space \GM@JK@imagetype% - \space-c\space "\GM@JK@color"% - \space-n\space \GM@JK@number% - \space-o\space \GM@JK@file}% + \ifthenelse{\equal{\GM@JK@mode}{gm}}% + {% + \immediate\write18{getmapdl \space-l\space "\GM@JK@location@string"% + \space-m\space gm% + \space-x\space \GM@JK@xsize% + \space-y\space \GM@JK@ysize% + \space-z\space \GM@JK@zoom% + \space-s\space \GM@JK@scale% + \space-t\space \GM@JK@type% + \space-i\space \GM@JK@imagetype% + \space-c\space "\GM@JK@color"% + \space-n\space \GM@JK@number% + \space-o\space \GM@JK@file}% + }% + {% + \ifthenelse{\equal{\GM@JK@mode}{gsv}}% + {% + \immediate\write18{getmapdl \space-l\space "\GM@JK@location@string"% + \space-m\space gsv% + \space-x\space \GM@JK@xsize% + \space-y\space \GM@JK@ysize% + \space-H\space \GM@JK@heading% + \space-F\space \GM@JK@fov% + \space-T\space \GM@JK@pitch% + \space-o\space \GM@JK@file}% + }% + {% + \PackageError{getmap}{invalid mode}{invalid mode! Use osm, gm or gsv!}% + }% + }% }% \else% \PackageError{getmap}{\write18 disabled}% @@ -1218,6 +1340,13 @@ emph={}} }% {}% \setkeys{getmap}{#1}% +% \end{macrocode} +% In \texttt{gsv} mode, we have an implicit \texttt{imagetype=jpg}. +% Therefore, we have to set it to allow the later test on the existence +% of the image file! +% \begin{macrocode} + \ifthenelse{\equal{\GM@JK@mode}{gsv}}% + {\def\GM@JK@imagetype{jpg}}{}% \PackageInfo{getmap}{using \GM@JK@inputencoding\space encoding}% \def\GM@JK@location{#2}% % \end{macrocode} diff --git a/Master/texmf-dist/doc/latex/getmap/getmap.pdf b/Master/texmf-dist/doc/latex/getmap/getmap.pdf index 2c49d1b422d..d0112ad6585 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 dc3f4fdec45..187fe0cb5e4 100755 --- a/Master/texmf-dist/doc/latex/getmap/install.bat +++ b/Master/texmf-dist/doc/latex/getmap/install.bat @@ -51,6 +51,8 @@ del *.sty del *.cfg del *.toc del *.txt +del *.png +del *.jpg 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 9967330f4f6..632f43676c6 100644 --- a/Master/texmf-dist/doc/latex/getmap/makefile +++ b/Master/texmf-dist/doc/latex/getmap/makefile @@ -62,7 +62,7 @@ clean: *.bbl *.blg *.ins *.txt *.bib cleanall: clean - $(RM) getmapdl.lua *.sty *.png \ + $(RM) getmapdl.lua *.sty *.png *.jpg\ *.cfg *.tex README getmap.pdf .PHONY: all doc package install uninstall styles git ctan clean cleanall diff --git a/Master/texmf-dist/scripts/getmap/getmapdl.lua b/Master/texmf-dist/scripts/getmap/getmapdl.lua index 198796414bd..e3611a928ca 100755 --- a/Master/texmf-dist/scripts/getmap/getmapdl.lua +++ b/Master/texmf-dist/scripts/getmap/getmapdl.lua @@ -12,6 +12,7 @@ local url = require("socket.url") local OSMURL = "http://open.mapquestapi.com/staticmap/v4/getplacemap" local GMURL = "http://maps.googleapis.com/maps/api/staticmap" +local GSVURL = "http://maps.googleapis.com/maps/api/streetview" local KEY = "" local MODE = "" local LOCATION = "" @@ -28,9 +29,12 @@ local NUMBER = "" local VISIBLE = "" local IPATH = "" local MARKERS = "" +local HEADING = "" +local FOV = "" +local PITCH = "" local OFILE = "getmap" local QUIET = "false" -local VERSION = "v1.0 (15/07/2014)" +local VERSION = "v1.1 (19/07/2014)" function pversion() print("getmapdl.lua " .. VERSION) @@ -96,6 +100,14 @@ getmapdl.lua [options] -P specify path from location to location e.g.: &path=weight:7|color:purple|loc1|loc2 + gsv mode only: + + -H specify heading (view) (0) (0 -- 360) (east: 90, ...) + + -T specify the pitch (angle) (0) (-90 -- 90) + + -F specify horizontal field of view (90) (0 -- 120) + The field of view is expressed in degrees and a kind of zoom! ]]) pversion() end @@ -110,8 +122,7 @@ function getmap_warning(warningtext) end function check_number(var, varname) - local number='^[0-9]+$' - if not(string.match(var, '^[0-9]+$')) then + if not(string.match(var, '^[-]?[0-9]+$')) then getmap_error(2, varname .. " can't be " .. var .. "! Not a number!") end end @@ -123,6 +134,8 @@ function check_range(var,min,max,exitcode,varname) end end +print("\n") + do local newarg = {} local i, limit = 1, #arg @@ -169,6 +182,15 @@ do elseif arg[i] == "-M" then MARKERS = arg[i+1] i = i + 1 + elseif arg[i] == "-H" then + HEADING = arg[i+1] + i = i + 1 + elseif arg[i] == "-T" then + PITCH = arg[i+1] + i = i + 1 + elseif arg[i] == "-F" then + FOV = arg[i+1] + i = i + 1 elseif arg[i] == "-V" then VISIBLE = arg[i+1] i = i + 1 @@ -228,6 +250,8 @@ end if SIZE == "" then if MODE == "gm" then SIZE = XSIZE .. "x" .. YSIZE + elseif MODE == "gsv" then + SIZE = XSIZE .. "x" .. YSIZE elseif MODE == "osm" then SIZE = XSIZE .. "," .. YSIZE end @@ -256,8 +280,11 @@ if TYPE == "" then end if IMAGETYPE == "" then - IMAGETYPE="png" - getmap_warning("IMAGETYPE not specified; using png as default!") + if MODE == "gsv" then + else + IMAGETYPE="png" + getmap_warning("IMAGETYPE not specified; using png as default!") + end end if COLOR == "" then @@ -271,8 +298,28 @@ if COLOR == "" then end if NUMBER == "" then - NUMBER=1 - getmap_warning("NUMBER not specified; using 1 as default!") + if MODE == "gsv" then + else + NUMBER=1 + getmap_warning("NUMBER not specified; using 1 as default!") + end +end + +if MODE == "gsv" then + if HEADING == "" then + HEADING=0 + getmap_warning("HEADING not specified; using 0 as default!") + end + + if FOV == "" then + FOV=90 + getmap_warning("FOV not specified; using 90 as default!") + end + + if PITCH == "" then + PITCH=0 + getmap_warning("PITCH not specified; using 0 as default!") + end end if MODE == "gm" then @@ -284,6 +331,12 @@ if MODE == "gm" then check_range(XSIZE,1,640,12,"XSIZE") check_range(YSIZE,1,640,13,"YSIZE") check_range(SCALE,1,2,14,"SCALE") +elseif MODE == "gsv" then + check_range(XSIZE,1,640,12,"XSIZE") + check_range(YSIZE,1,640,13,"YSIZE") + check_range(HEADING,0,360,15,"HEADING") + check_range(FOV,0,120,16,"FOV") + check_range(PITCH,-90,90,17,"PITCH") elseif MODE == "osm" then check_range(XSIZE,1,3840,11,"XSIZE") check_range(YSIZE,1,3840,12,"YSIZE") @@ -307,6 +360,9 @@ local USHOWICON = "" local UIMAGETYPE = "" local UVISIBLE = "" local UIPATH = "" +local UHEADING = "" +local UFOV = "" +local UPITCH = "" local UOFILE = "" local IMGURL = "" @@ -347,6 +403,14 @@ if MODE == "gm" then end UOFILE = OFILE .. "." .. IMAGETYPE IMGURL = GMURL .. "?" .. ULOCATION .. USIZE .. UZOOM .. UMARKERS .. UTYPE .. USCALE .. UIMAGETYPE .. UVISIBLE .. UIPATH .. "&sensor=false" +elseif MODE == "gsv" then + ULOCATION = "location=" .. url.escape(LOCATION) + USIZE = "&size=" .. url.escape(SIZE) + UHEADING = "&heading=" .. url.escape(HEADING) + UFOV = "&fov=" .. url.escape(FOV) + UPITCH = "&pitch=" .. url.escape(PITCH) + UOFILE = OFILE .. ".jpg" + IMGURL = GSVURL .. "?" .. ULOCATION .. USIZE .. UHEADING .. UFOV .. UPITCH .. "&sensor=false" elseif MODE == "osm" then UKEY = "?key=" .. url.escape(KEY) ULOCATION = "&location=" .. url.escape(LOCATION) @@ -369,7 +433,7 @@ ofile, msg = io.open(UOFILE, "wb") if not ofile then getmap_error(21, msg) end -print("\n\ngetmap.lua:") +print("\n\ngetmapdl.lua:") print("url = " .. IMGURL) print("output = " .. UOFILE) ret, msg = http.request{ diff --git a/Master/texmf-dist/tex/latex/getmap/getmap.sty b/Master/texmf-dist/tex/latex/getmap/getmap.sty index de8d3d34243..424f14ea8e7 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/15 v1.2 getmap.sty - Josef Kleber (C) 2014]% +\ProvidesPackage{getmap}[2014/07/19 v1.3 getmap.sty - Josef Kleber (C) 2014]% \RequirePackage{xkeyval}% \RequirePackage{stringenc}% \RequirePackage{ifthen}% @@ -53,6 +53,9 @@ \GM@JK@define@key{GM@JK}{getmap}{imagetype}{png}% \GM@JK@define@key{GM@JK}{getmap}{color}{yellow_1}% \GM@JK@define@key{GM@JK}{getmap}{number}{1}% +\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}{file}{getmap}% \GM@JK@define@key{GM@JK}{getmap}{inputencoding}{}% \GM@JK@define@key{GM@JK}{getmap}{overwrite}{true}% @@ -73,7 +76,7 @@ \gdef\GM@JK@inputencoding{utf8}% }% \newif\ifGM@JK@writexviii\GM@JK@writexviiifalse% -\ExecuteOptionsX{mode,xsize,ysize,scale,zoom,type,imagetype,color,number,file}% +\ExecuteOptionsX{mode,xsize,ysize,scale,zoom,type,imagetype,color,number,file,heading,fov,pitch}% \ProcessOptionsX\relax% \ifthenelse{\equal{\GM@JK@mode}{gm}}% {% @@ -117,17 +120,36 @@ \space-o\space \GM@JK@file}% }% {% - \immediate\write18{getmapdl \space-l\space "\GM@JK@location@string"% - \space-m\space gm% - \space-x\space \GM@JK@xsize% - \space-y\space \GM@JK@ysize% - \space-z\space \GM@JK@zoom% - \space-s\space \GM@JK@scale% - \space-t\space \GM@JK@type% - \space-i\space \GM@JK@imagetype% - \space-c\space "\GM@JK@color"% - \space-n\space \GM@JK@number% - \space-o\space \GM@JK@file}% + \ifthenelse{\equal{\GM@JK@mode}{gm}}% + {% + \immediate\write18{getmapdl \space-l\space "\GM@JK@location@string"% + \space-m\space gm% + \space-x\space \GM@JK@xsize% + \space-y\space \GM@JK@ysize% + \space-z\space \GM@JK@zoom% + \space-s\space \GM@JK@scale% + \space-t\space \GM@JK@type% + \space-i\space \GM@JK@imagetype% + \space-c\space "\GM@JK@color"% + \space-n\space \GM@JK@number% + \space-o\space \GM@JK@file}% + }% + {% + \ifthenelse{\equal{\GM@JK@mode}{gsv}}% + {% + \immediate\write18{getmapdl \space-l\space "\GM@JK@location@string"% + \space-m\space gsv% + \space-x\space \GM@JK@xsize% + \space-y\space \GM@JK@ysize% + \space-H\space \GM@JK@heading% + \space-F\space \GM@JK@fov% + \space-T\space \GM@JK@pitch% + \space-o\space \GM@JK@file}% + }% + {% + \PackageError{getmap}{invalid mode}{invalid mode! Use osm, gm or gsv!}% + }% + }% }% \else% \PackageError{getmap}{\write18 disabled}% @@ -149,6 +171,8 @@ }% {}% \setkeys{getmap}{#1}% + \ifthenelse{\equal{\GM@JK@mode}{gsv}}% + {\def\GM@JK@imagetype{jpg}}{}% \PackageInfo{getmap}{using \GM@JK@inputencoding\space encoding}% \def\GM@JK@location{#2}% \StringEncodingConvert% -- cgit v1.2.3