summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Build/source/texk/texlive/linked_scripts/getmap/getmapdl.lua210
-rw-r--r--Master/texmf-dist/doc/latex/getmap/README17
-rw-r--r--Master/texmf-dist/doc/latex/getmap/getmap.dtx451
-rw-r--r--Master/texmf-dist/doc/latex/getmap/getmap.pdfbin1767909 -> 1938258 bytes
-rwxr-xr-xMaster/texmf-dist/scripts/getmap/getmapdl.lua210
-rw-r--r--Master/texmf-dist/tex/latex/getmap/getmap.sty2
6 files changed, 709 insertions, 181 deletions
diff --git a/Build/source/texk/texlive/linked_scripts/getmap/getmapdl.lua b/Build/source/texk/texlive/linked_scripts/getmap/getmapdl.lua
index f8dac4aa3cd..0ca4ac6bbb3 100644
--- a/Build/source/texk/texlive/linked_scripts/getmap/getmapdl.lua
+++ b/Build/source/texk/texlive/linked_scripts/getmap/getmapdl.lua
@@ -3,7 +3,8 @@
-- getmapdl [options]
--
-- downloads an OpenStreetMap, Google Maps or Google Street View map
--- specified by [options] or parses gpx or gps files to create encoded polylines
+-- specified by [options] or parses gpx, gps and kml files to create
+-- encoded polylines
--
-- License: LPPL
--
@@ -36,9 +37,10 @@ local FOV = ""
local PITCH = ""
local LANGUAGE = ""
local GPFILE = ""
+local KMLFILE = ""
local OFILE = "getmap"
local QUIET = "false"
-local VERSION = "v1.3 (16/08/2014)"
+local VERSION = "v1.4 (18/09/2014)"
function pversion()
print("getmapdl.lua " .. VERSION)
@@ -51,12 +53,12 @@ function phelp()
getmapdl.lua [options]
downloads an OpenStreetMap, Google Maps or Google Street View map
- specified by [options] or parses gpx or gps files to create
+ specified by [options] or parses gpx, gps and kml files to create
encoded polylines
Options:
- -m specify the mode (osm|gm|gsv|gpx2epl|gps2epl|gpx2gps)
+ -m specify the mode (osm|gm|gsv|gpx2epl|gps2epl|gpx2gps|kml2epl|kml2gps)
-l specify a location
e.g. 'Bergheimer Straße 110A, 69115 Heidelberg, Germany'
@@ -124,6 +126,10 @@ getmapdl.lua [options]
-G specify the gpx or gps file
+ kml2epl and kml2gps mode only:
+
+ -K specify the kml file
+
]])
pversion()
end
@@ -172,6 +178,13 @@ function encodeNumber(number)
return table.concat(t)
end
+function printepl(epltable)
+ local string = table.concat(epltable)
+ -- sometimes the sting contains unwanted control characters
+ local stingwithoutcontrolcharacters = string:gsub("%c", "")
+ print(stingwithoutcontrolcharacters)
+end
+
do
local newarg = {}
local i, limit = 1, #arg
@@ -242,6 +255,9 @@ do
elseif arg[i] == "-G" then
GPFILE = arg[i+1]
i = i + 1
+ elseif arg[i] == "-K" then
+ KMLFILE = arg[i+1]
+ i = i + 1
elseif arg[i] == "-o" then
OFILE = arg[i+1]
i = i + 1
@@ -264,22 +280,42 @@ if QUIET == 1 then
end
if MODE == "gpx2epl" then
- local file = io.open(GPFILE, "r")
+ local file = GPFILE
+ local name
+ local desc
local Olatitude = 0
local Olongitude = 0
local epl = {}
- io.input(file)
- while true do
- local line = io.read()
- if line == nil
- then
- break
+ for line in io.lines(file)
+ do
+ local latitude
+ local longitude
+ local encnum
+
+ if string.match(line, "<trk>") then
+ Olatitude = 0
+ Olongitude = 0
+ name = ""
+ desc = ""
+ epl = {}
end
- if string.match(line, "trkpt") then
- local latitude
- local longitude
- local encnum
+ if string.match(line, "<name") then
+ name = string.match(line, '<name>(.-)</name>')
+ if name == nil then
+ name = "Name (E)"
+ end
+ end
+ if string.match(line, "<desc") then
+ desc = string.match(line, '<desc>(.-)</desc>')
+ if desc == nil then
+ desc = ""
+ end
+ end
+ if string.match(line, "<trkseg") then
+ print("Route: " .. name .. " [" .. desc .. "]")
+ end
+ if string.match(line, "<trkpt") then
latitude = string.match(line, 'lat="(.-)"')
longitude = string.match(line, 'lon="(.-)"')
latitude = round(latitude,5)*100000
@@ -291,47 +327,64 @@ if MODE == "gpx2epl" then
Olatitude = latitude
Olongitude = longitude
end
+ if string.match(line, "</trk>") then
+ printepl(epl)
+ print("\n")
+ end
end
- local string = table.concat(epl)
- -- sometimes the sting contains unwanted control characters
- local stingwithoutcontrolcharacters = string:gsub("%c", "")
- print(stingwithoutcontrolcharacters)
os.exit(0)
end
if MODE == "gpx2gps" then
- local file = io.open(GPFILE, "r")
- io.input(file)
- while true do
- local line = io.read()
- if line == nil
- then
- break
+ local file = GPFILE
+ local name
+ local desc
+
+ for line in io.lines(file)
+ do
+ local latitude
+ local longitude
+ local encnum
+
+ if string.match(line, "<trk>") then
+ name = ""
+ desc = ""
end
- if string.match(line, "trkpt") then
- local latitude
- local longitude
+ if string.match(line, "<name") then
+ name = string.match(line, '<name>(.-)</name>')
+ if name == nil then
+ name = "Name (E)"
+ end
+ end
+ if string.match(line, "<desc") then
+ desc = string.match(line, '<desc>(.-)</desc>')
+ if desc == nil then
+ desc = ""
+ end
+ end
+ if string.match(line, "<trkseg") then
+ print("Route: " .. name .. " [" .. desc .. "]")
+ end
+ if string.match(line, "<trkpt") then
latitude = string.match(line, 'lat="(.-)"')
longitude = string.match(line, 'lon="(.-)"')
print(latitude .. "," .. longitude)
end
+ if string.match(line, "</trk>") then
+ print("\n")
+ end
end
os.exit(0)
end
if MODE == "gps2epl" then
- local file = io.open(GPFILE, "r")
+ local file = GPFILE
local Olatitude = 0
local Olongitude = 0
local epl = {}
- io.input(file)
- while true do
- local line = io.read()
- if line == nil
- then
- break
- end
+ for line in io.lines(file)
+ do
local latitude
local longitude
local encnum
@@ -345,10 +398,85 @@ if MODE == "gps2epl" then
Olatitude = latitude
Olongitude = longitude
end
- local string = table.concat(epl)
- -- sometimes the sting contains unwanted control characters
- local stingwithoutcontrolcharacters = string:gsub("%c", "")
- print(stingwithoutcontrolcharacters)
+ printepl(epl)
+ os.exit(0)
+end
+
+if MODE == "kml2gps" or MODE == "kml2epl" then
+ local file = KMLFILE
+ local name
+ local cdata
+ local cotype
+ local Olatitude = 0
+ local Olongitude = 0
+ local epl = {}
+
+ for line in io.lines(file)
+ do
+ local latitude
+ local longitide
+ local elevation
+
+ -- reset for new route
+ if string.match(line, "<Placemark>") then
+ Olatitude = 0
+ Olongitude = 0
+ cotype = nil
+ epl = {}
+ end
+ if string.match(line, "<name>") then
+ name = string.match(line, '<name>(.-)</name>')
+ if name == nil then
+ name = "Name (E)"
+ end
+ end
+ if string.match(line, "CDATA") then
+ cdata = string.match(line, 'CDATA%[(.-)%]')
+ if cdata == nil then
+ cdata = ""
+ end
+ end
+ if string.match(line, "<Point>") then
+ cotype = "point"
+ end
+ if string.match(line, "<LineString>") then
+ cotype = "route"
+ end
+ if cotype == "point" or cotype == "route" then
+ if string.match(line, "<coordinates>") then
+ local colist = string.match(line, '<coordinates>(.-)</coordinates>')
+ if cotype == "route" then
+ print("Route: " .. name)
+ else
+ print("Point: " .. name .. " [" .. cdata .. "]")
+ end
+ for cocsv in string.gmatch(colist, "%S+") do
+ longitude, latitude, altitude = cocsv:match("([^,]+),([^,]+),([^,]+)")
+ if MODE == "kml2epl" then
+ local encnum
+ if cotype == "route" then
+ latitude = round(latitude,5)*100000
+ longitude = round(longitude,5)*100000
+ encnum = encodeNumber(latitude - Olatitude)
+ table.insert(epl,encnum)
+ encnum = encodeNumber(longitude - Olongitude)
+ table.insert(epl,encnum)
+ Olatitude = latitude
+ Olongitude = longitude
+ else
+ print(latitude .. "," .. longitude)
+ end
+ else
+ print(latitude .. "," .. longitude)
+ end
+ end
+ if MODE == "kml2epl" and cotype == "route" then
+ printepl(epl)
+ end
+ print("\n")
+ end
+ end
+ end
os.exit(0)
end
diff --git a/Master/texmf-dist/doc/latex/getmap/README b/Master/texmf-dist/doc/latex/getmap/README
index c3ce117374a..ef8f4e64f16 100644
--- a/Master/texmf-dist/doc/latex/getmap/README
+++ b/Master/texmf-dist/doc/latex/getmap/README
@@ -8,16 +8,21 @@ use this script also from the command line.
License: LPPL
-Changes in v1.6:
+Changes in v1.7:
-- added gpx2epl, gps2epl and gpx2gps modes to getmapdl.lua
+- added kml2epl and kml2gps modes to getmapdl.lua
- parses gpx and gps files and outputs gps or epl (encoded
- polylines) to STDOUT, e.g:
+ Google's *new* version of 'My Maps' allows the definition of
+ markers, routes and arbitrary lines on different layers and
+ export of all of these into kml files.
- getmapdl -m gpx2epl -G myroute.gpx >myroute.epl
+ getmapdl -m kml2epl -K file.kml
-- removed gpx2gps bash file
+ will parse the file and output the geographical coordinates of
+ defined places and the routes and lines as encoded polylines
+
+- added multi track support for gpx2epl and gpx2gps modes;
+ revised gps2epl mode
- updated documentation
diff --git a/Master/texmf-dist/doc/latex/getmap/getmap.dtx b/Master/texmf-dist/doc/latex/getmap/getmap.dtx
index c6b299b4652..29d6404f5fd 100644
--- a/Master/texmf-dist/doc/latex/getmap/getmap.dtx
+++ b/Master/texmf-dist/doc/latex/getmap/getmap.dtx
@@ -14,16 +14,21 @@ use this script also from the command line.
License: LPPL
-Changes in v1.6:
+Changes in v1.7:
-- added gpx2epl, gps2epl and gpx2gps modes to getmapdl.lua
+- added kml2epl and kml2gps modes to getmapdl.lua
- parses gpx and gps files and outputs gps or epl (encoded
- polylines) to STDOUT, e.g:
+ Google's *new* version of 'My Maps' allows the definition of
+ markers, routes and arbitrary lines on different layers and
+ export of all of these into kml files.
- getmapdl -m gpx2epl -G myroute.gpx >myroute.epl
+ getmapdl -m kml2epl -K file.kml
+
+ will parse the file and output the geographical coordinates of
+ defined places and the routes and lines as encoded polylines
-- removed gpx2gps bash file
+- added multi track support for gpx2epl and gpx2gps modes;
+ revised gps2epl mode
- updated documentation
@@ -134,6 +139,13 @@ download getmap.dtx and makefile (Linux) or install.bat (Windows)
year = {2014},
}
+@misc{bib:berlinkml,
+ author = {Kleber, Josef},
+ note = {\href{https://bitbucket.org/kleberj/getmap/downloads/Berlin.kml}{https://bitbucket.org/kleberj/getmap/downloads/Berlin.kml}},
+ title = {{Berlin: Hbf Berlin - Brandenburger Tor (getmap Test)}},
+ year = {2014},
+ }
+
%</bibfile>
%<*luafile>
#!/usr/bin/env texlua
@@ -141,7 +153,8 @@ download getmap.dtx and makefile (Linux) or install.bat (Windows)
-- getmapdl [options]
--
-- downloads an OpenStreetMap, Google Maps or Google Street View map
--- specified by [options] or parses gpx or gps files to create encoded polylines
+-- specified by [options] or parses gpx, gps and kml files to create
+-- encoded polylines
--
-- License: LPPL
--
@@ -174,9 +187,10 @@ local FOV = ""
local PITCH = ""
local LANGUAGE = ""
local GPFILE = ""
+local KMLFILE = ""
local OFILE = "getmap"
local QUIET = "false"
-local VERSION = "v1.3 (16/08/2014)"
+local VERSION = "v1.4 (18/09/2014)"
function pversion()
print("getmapdl.lua " .. VERSION)
@@ -189,12 +203,12 @@ function phelp()
getmapdl.lua [options]
downloads an OpenStreetMap, Google Maps or Google Street View map
- specified by [options] or parses gpx or gps files to create
+ specified by [options] or parses gpx, gps and kml files to create
encoded polylines
Options:
- -m specify the mode (osm|gm|gsv|gpx2epl|gps2epl|gpx2gps)
+ -m specify the mode (osm|gm|gsv|gpx2epl|gps2epl|gpx2gps|kml2epl|kml2gps)
-l specify a location
e.g. 'Bergheimer Straße 110A, 69115 Heidelberg, Germany'
@@ -262,6 +276,10 @@ getmapdl.lua [options]
-G specify the gpx or gps file
+ kml2epl and kml2gps mode only:
+
+ -K specify the kml file
+
]])
pversion()
end
@@ -310,6 +328,13 @@ function encodeNumber(number)
return table.concat(t)
end
+function printepl(epltable)
+ local string = table.concat(epltable)
+ -- sometimes the sting contains unwanted control characters
+ local stingwithoutcontrolcharacters = string:gsub("%c", "")
+ print(stingwithoutcontrolcharacters)
+end
+
do
local newarg = {}
local i, limit = 1, #arg
@@ -380,6 +405,9 @@ do
elseif arg[i] == "-G" then
GPFILE = arg[i+1]
i = i + 1
+ elseif arg[i] == "-K" then
+ KMLFILE = arg[i+1]
+ i = i + 1
elseif arg[i] == "-o" then
OFILE = arg[i+1]
i = i + 1
@@ -402,22 +430,42 @@ if QUIET == 1 then
end
if MODE == "gpx2epl" then
- local file = io.open(GPFILE, "r")
+ local file = GPFILE
+ local name
+ local desc
local Olatitude = 0
local Olongitude = 0
local epl = {}
-
- io.input(file)
- while true do
- local line = io.read()
- if line == nil
- then
- break
+
+ for line in io.lines(file)
+ do
+ local latitude
+ local longitude
+ local encnum
+
+ if string.match(line, "<trk>") then
+ Olatitude = 0
+ Olongitude = 0
+ name = ""
+ desc = ""
+ epl = {}
end
- if string.match(line, "trkpt") then
- local latitude
- local longitude
- local encnum
+ if string.match(line, "<name") then
+ name = string.match(line, '<name>(.-)</name>')
+ if name == nil then
+ name = "Name (E)"
+ end
+ end
+ if string.match(line, "<desc") then
+ desc = string.match(line, '<desc>(.-)</desc>')
+ if desc == nil then
+ desc = ""
+ end
+ end
+ if string.match(line, "<trkseg") then
+ print("Route: " .. name .. " [" .. desc .. "]")
+ end
+ if string.match(line, "<trkpt") then
latitude = string.match(line, 'lat="(.-)"')
longitude = string.match(line, 'lon="(.-)"')
latitude = round(latitude,5)*100000
@@ -429,47 +477,64 @@ if MODE == "gpx2epl" then
Olatitude = latitude
Olongitude = longitude
end
+ if string.match(line, "</trk>") then
+ printepl(epl)
+ print("\n")
+ end
end
- local string = table.concat(epl)
- -- sometimes the sting contains unwanted control characters
- local stingwithoutcontrolcharacters = string:gsub("%c", "")
- print(stingwithoutcontrolcharacters)
os.exit(0)
end
if MODE == "gpx2gps" then
- local file = io.open(GPFILE, "r")
- io.input(file)
- while true do
- local line = io.read()
- if line == nil
- then
- break
+ local file = GPFILE
+ local name
+ local desc
+
+ for line in io.lines(file)
+ do
+ local latitude
+ local longitude
+ local encnum
+
+ if string.match(line, "<trk>") then
+ name = ""
+ desc = ""
+ end
+ if string.match(line, "<name") then
+ name = string.match(line, '<name>(.-)</name>')
+ if name == nil then
+ name = "Name (E)"
+ end
end
- if string.match(line, "trkpt") then
- local latitude
- local longitude
+ if string.match(line, "<desc") then
+ desc = string.match(line, '<desc>(.-)</desc>')
+ if desc == nil then
+ desc = ""
+ end
+ end
+ if string.match(line, "<trkseg") then
+ print("Route: " .. name .. " [" .. desc .. "]")
+ end
+ if string.match(line, "<trkpt") then
latitude = string.match(line, 'lat="(.-)"')
longitude = string.match(line, 'lon="(.-)"')
print(latitude .. "," .. longitude)
end
+ if string.match(line, "</trk>") then
+ print("\n")
+ end
end
os.exit(0)
end
if MODE == "gps2epl" then
- local file = io.open(GPFILE, "r")
+ local file = GPFILE
local Olatitude = 0
local Olongitude = 0
local epl = {}
- io.input(file)
- while true do
- local line = io.read()
- if line == nil
- then
- break
- end
+ for line in io.lines(file)
+ do
local latitude
local longitude
local encnum
@@ -483,10 +548,85 @@ if MODE == "gps2epl" then
Olatitude = latitude
Olongitude = longitude
end
- local string = table.concat(epl)
- -- sometimes the sting contains unwanted control characters
- local stingwithoutcontrolcharacters = string:gsub("%c", "")
- print(stingwithoutcontrolcharacters)
+ printepl(epl)
+ os.exit(0)
+end
+
+if MODE == "kml2gps" or MODE == "kml2epl" then
+ local file = KMLFILE
+ local name
+ local cdata
+ local cotype
+ local Olatitude = 0
+ local Olongitude = 0
+ local epl = {}
+
+ for line in io.lines(file)
+ do
+ local latitude
+ local longitide
+ local elevation
+
+ -- reset for new route
+ if string.match(line, "<Placemark>") then
+ Olatitude = 0
+ Olongitude = 0
+ cotype = nil
+ epl = {}
+ end
+ if string.match(line, "<name>") then
+ name = string.match(line, '<name>(.-)</name>')
+ if name == nil then
+ name = "Name (E)"
+ end
+ end
+ if string.match(line, "CDATA") then
+ cdata = string.match(line, 'CDATA%[(.-)%]')
+ if cdata == nil then
+ cdata = ""
+ end
+ end
+ if string.match(line, "<Point>") then
+ cotype = "point"
+ end
+ if string.match(line, "<LineString>") then
+ cotype = "route"
+ end
+ if cotype == "point" or cotype == "route" then
+ if string.match(line, "<coordinates>") then
+ local colist = string.match(line, '<coordinates>(.-)</coordinates>')
+ if cotype == "route" then
+ print("Route: " .. name)
+ else
+ print("Point: " .. name .. " [" .. cdata .. "]")
+ end
+ for cocsv in string.gmatch(colist, "%S+") do
+ longitude, latitude, altitude = cocsv:match("([^,]+),([^,]+),([^,]+)")
+ if MODE == "kml2epl" then
+ local encnum
+ if cotype == "route" then
+ latitude = round(latitude,5)*100000
+ longitude = round(longitude,5)*100000
+ encnum = encodeNumber(latitude - Olatitude)
+ table.insert(epl,encnum)
+ encnum = encodeNumber(longitude - Olongitude)
+ table.insert(epl,encnum)
+ Olatitude = latitude
+ Olongitude = longitude
+ else
+ print(latitude .. "," .. longitude)
+ end
+ else
+ print(latitude .. "," .. longitude)
+ end
+ end
+ if MODE == "kml2epl" and cotype == "route" then
+ printepl(epl)
+ end
+ print("\n")
+ end
+ end
+ end
os.exit(0)
end
@@ -1219,7 +1359,7 @@ emph={}}
% &markers=label:P|color:green|Pergamonmuseum, Berlin%
% &markers=label:N|color:blue|Neues Museum, Berlin}%
% ]{}
-% \includegraphics[width=10cm]{bmus1}
+% \begin{center}\includegraphics[width=10cm]{bmus1}\end{center}
% \iffalse
%<*example>
% \fi
@@ -1250,7 +1390,7 @@ 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}
+% \begin{center}\includegraphics[width=10cm]{bmus2}\end{center}
% \iffalse
%<*example>
% \fi
@@ -1299,7 +1439,7 @@ path={&path=weight:5|color:orange|Bode 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}
+% \begin{center}\includegraphics[width=10cm]{bmus3}\end{center}
%
% You can also use \texttt{fillcolor} to mark areas! In paths, you
% can also specify RGB32 colors, in which the last byte defines opacity,
@@ -1310,7 +1450,7 @@ path={&path=weight:5|color:orange|Bode Museum, Berlin|%
% 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}
+% \begin{center}\includegraphics[width=10cm]{cpny}\end{center}
% \iffalse
%<*example>
% \fi
@@ -1355,7 +1495,7 @@ path={&path=weight:5|color:orange|Bode Museum, Berlin|%
% By default, the image is saved under the name \texttt{getmap.png}!
% If you need only one map (e.g. the office of Dante e.V.) in your document, it can be as simple as:
%
-% \includegraphics[width=9cm]{getmap}
+% \begin{center}\includegraphics[width=9cm]{getmap}\end{center}
%
% \iffalse
%<*example>
@@ -1368,12 +1508,13 @@ path={&path=weight:5|color:orange|Bode Museum, Berlin|%
%</example>
% \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:
%
% \getmap[file=dantegm,mode=gm]{Bergheimer Straße 110A, 69115 Heidelberg, Germany}
-% \includegraphics[width=9cm]{dantegm}
+% \begin{center}\includegraphics[width=9cm]{dantegm}\end{center}
% \iffalse
%<*example>
% \fi
@@ -1389,7 +1530,7 @@ path={&path=weight:5|color:orange|Bode Museum, Berlin|%
% The same map as satellite image:
%
% \getmap[file=dantegmsat,mode=gm,type=satellite]{Bergheimer Straße 110A, 69115 Heidelberg, Germany}
-% \includegraphics[width=9cm]{dantegmsat}
+% \begin{center}\includegraphics[width=9cm]{dantegmsat}\end{center}
% \iffalse
%<*example>
% \fi
@@ -1401,10 +1542,11 @@ path={&path=weight:5|color:orange|Bode Museum, Berlin|%
% \iffalse
%</example>
% \fi
+% \clearpage
% L'afrique, mon amour!
%
% \getmap[file=africa,mode=gm,type=terrain,xsize=500,ysize=500,scale=2,zoom=3]{0,16}
-% \includegraphics[width=9cm]{africa}
+% \begin{center}\includegraphics[width=9cm]{africa}\end{center}
% \iffalse
%<*example>
% \fi
@@ -1419,7 +1561,7 @@ path={&path=weight:5|color:orange|Bode Museum, Berlin|%
% L'amour, ...
%
% \getmap[file=paris,mode=gm,type=hybrid,xsize=500,ysize=300,scale=2,zoom=16]{Tour Eiffel, Paris}
-% \includegraphics[width=9cm]{paris}
+% \begin{center}\includegraphics[width=9cm]{paris}\end{center}
% \iffalse
%<*example>
% \fi
@@ -1431,10 +1573,11 @@ path={&path=weight:5|color:orange|Bode Museum, Berlin|%
% \iffalse
%</example>
% \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}
+% \begin{center}\includegraphics[width=4cm]{parisgsv}\end{center}
% \iffalse
%<*example>
% \fi
@@ -1446,11 +1589,11 @@ path={&path=weight:5|color:orange|Bode Museum, Berlin|%
% \iffalse
%</example>
% \fi
-% \clearpage
+%
% and from the platform:
%
% \getmap[file=parisgsvp,mode=gsv,heading=30,pitch=-25,fov=60]{Tour Eiffel, Paris}
-% \includegraphics[width=8cm]{parisgsvp}
+% \begin{center}\includegraphics[width=8cm]{parisgsvp}\end{center}
% \iffalse
%<*example>
% \fi
@@ -1464,7 +1607,7 @@ path={&path=weight:5|color:orange|Bode Museum, Berlin|%
% \fi
% \section{The \texttt{getmapdl} Lua script}
% Basically, the \texttt{getmapdl} Lua script downloads static map images
-% depending on command line options and allows to parse \texttt{gpx} and
+% depending on command line options and allows to parse \texttt{kml}, \texttt{gpx} and
% \texttt{gps} (a plain list of geographical coordinate pairs \texttt{(latitude,longitude)}
% on each line) files and outputs \texttt{gps} or encoded polylines (epl).
% The script offers the following modes (\texttt{-m}):
@@ -1475,6 +1618,9 @@ path={&path=weight:5|color:orange|Bode Museum, Berlin|%
% \item[gpx2epl] parses a \texttt{gpx} file and outputs encoded polylines (\texttt{epl}) to \texttt{STDOUT}
% \item[gps2epl] parses a \texttt{gps} file and outputs \texttt{epl}
% \item[gpx2gps] parses a \texttt{gpx} file and outputs a list of geographic coordinate pairs (\texttt{gps})
+% \item[kml2epl] parses a \texttt{kml} file and outputs geographical coordinates of places and
+% encoded polylines for routes and lines
+% \item[kml2gps] parses a \texttt{kml} file and outputs geographical coordinates
% \end{description}
% The first three modes are used by \cmd\getmap. You may use the script also from the command line!
% \texttt{getmapdl -h} will give you a list of available commad line options.
@@ -1509,12 +1655,55 @@ _p~iF~ps|U_ulLnnqClqNvxq`@
% This encoded polyline can be used for the \texttt{path} or \texttt{pathfile}
% option of \cmd\getmap.
% \section{How to define routes}
-% One possible way is to use Google Maps
-% 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.
+% Routes are described by so called encoded polylines and can be used with
+% \texttt{enc:polyline\_data} as location specifier in a \texttt{path}.
% 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.
+% Please note that the length of the URL is limited to 2048 bytes. So, there's
+% no way to support extreme long paths!
+% \subsection{OpenStreetMap}
+% OpenStreetMap does not offer routing service directly, but you can
+% use an OpenStreetMap based route service\footnote{\href{http://openrouteservice.org}{http://openrouteservice.org}}
+% to create your route and export it to a \texttt{gpx} file\footnote{This also means that you can visualize your own routes tracked with hardware or a software app!}.
+% It's basically a xml-packaged list of geographical coordinates.
+% You can use the \texttt{getmapdl} script to convert a route to encoded polylines, e.g.
+% a pedestrian route from Berlin Central Station to Brandenburg Gate:
+%
+% \begin{filecontents*}{berlin.epl}
+% &path=weight:5|color:purple|enc:_xq_IcgrpA?AFE@?^BFE@A^U@CLQXEZU?gCR?B?DBF@@?vA?D?D?BAHE@JBN@JLGFCG[DC~C?@?F?R?vA?p@iB@i@Fe@JWRSTOf@Gh@C^A?e@?gE?w@r@?lB@hA?`@??M?aA?]dI??O?O?Cn@cBfBeF|AeEHNVNBc@H@H_AEwA?OAMNA@N
+% \end{filecontents*}
+% \getmap[file=berlin, mode=gm, language=de, scale=2,
+% xsize=400, ysize=600,
+% markers={&markers=size:mid|label:H|color:green|Berlin, Hbf
+% &markers=label:B|color:blue|Brandenburger Tor, Berlin},
+% pathfile={berlin.epl}]{}
+% \begin{center}\includegraphics[width=6cm]{berlin}\end{center}
+%
+% \iffalse
+%<*example>
+% \fi
+\begin{lstlisting}
+\begin{filecontents*}{berlin.epl}
+&path=weight:5|color:purple|enc:_xq_IcgrpA?AFE@?^BFE@A^U@CLQXEZU?
+gCR?B?DBF@@?vA?D?D?BAHE@JBN@JLGFCG[DC~C?@?F?R?vA?p@iB@i@Fe@JWRSTO
+f@Gh@C^A?e@?gE?w@r@?lB@hA?`@??M?aA?]dI??O?O?Cn@cBfBeF|AeEHNVNBc@H
+@H_AEwA?OAMNA@N
+\end{filecontents*}
+\getmap[file=berlin, mode=gm, language=de, scale=2,
+ xsize=400, ysize=600,
+markers={&markers=size:mid|label:H|color:green|Berlin, Hbf
+ &markers=label:B|color:blue|Brandenburger Tor, Berlin},
+pathfile={berlin.epl}]{}
+\includegraphics[width=6cm]{berlin}
+\end{lstlisting}
+% \iffalse
+%</example>
+% \fi
+%
+% \subsection{Google Maps}
+% One possible way is to use Google Maps'
+% online interactive map tool\footnote{\href{https://developers.google.com/maps/documentation/utilities/polylineutility}{https://developers.google.com/maps/documentation/utilities/polylineutility}}!
%
% \begin{filecontents*}{muc.epl}
% &path=weight:5|color:orange|enc:okydHa}peAXOHi@jANv@A@kJJmFAiDJuAHmDXcBb@cC`@gC^_DV}CJaCF{APaBVkBdAyEf@qC`@{B\aDSwB
@@ -1524,14 +1713,15 @@ _p~iF~ps|U_ulLnnqClqNvxq`@
% &markers=label:S|color:yellow|Stachus, München
% &markers=label:M|color:blue|Marienplatz, München},
% pathfile={muc.epl}]{}
-%\includegraphics[width=10cm]{muc}
+% \begin{center}\includegraphics[width=10cm]{muc}\end{center}
+%
% \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
+&path=weight:5|color:orange|enc:okydHa}peAXOHi@jANv@A@kJJmFAiDJuA
+HmDXcBb@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
@@ -1544,42 +1734,116 @@ pathfile={muc.epl}]{}
%</example>
% \fi
%
-% You can also use an OpenStreetMap based route service\footnote{\href{http://openrouteservice.org}{http://openrouteservice.org}}
-% to create your route and export it to a \texttt{gpx} file\footnote{This also means that you can visualize your own routes tracked with hardware or a software app!}.
-% It's basically a xml-packaged list of geographical coordinates.
-% You can use the \texttt{getmapdl} script to convert a route to encoded polylines, e.g.
-% a pedestrian route from Berlin Central Station to Brandenburg Gate:
+% You can also use the \textbf{new} version of \textit{My Maps}.
+% It allows you to define markers, routes and arbitrary lines on
+% different layers and to export these into a \texttt{kml} file,
+% e.g \href{https://bitbucket.org/kleberj/getmap/downloads/Berlin.kml}{berlin.kml}\footnote{\href{https://bitbucket.org/kleberj/getmap/downloads/Berlin.kml}{https://bitbucket.org/kleberj/getmap/downloads/Berlin.kml}}:
%
-% \begin{filecontents*}{berlin.epl}
-% &path=weight:5|color:purple|enc:_xq_IcgrpA?AFE@?^BFE@A^U@CLQXEZU?gCR?B?DBF@@?vA?D?D?BAHE@JBN@JLGFCG[DC~C?@?F?R?vA?p@iB@i@Fe@JWRSTOf@Gh@C^A?e@?gE?w@r@?lB@hA?`@??M?aA?]dI??O?O?Cn@cBfBeF|AeEHNVNBc@H@H_AEwA?OAMNA@N
+% \iffalse
+%<*example>
+% \fi
+\begin{lstlisting}
+$ getmapdl -m kml2epl -K Berlin.kml
+Route: Route von Berlin Hbf, Moabit nach Brandenburger Tor, Paris
+er Platz, Berlin
+k}q_IufrpA?iFQ?gCDQBMHSm@Wq@GQIK]{AUaA}AaICIMm@Kg@EUiByIi@cDSqA_@
+uBIa@a@gBpB[fAMhCS|@Gd@Ev@Ep@GfAIpC[bAMr@IbAMp@G\GtBUdCSp@MrAK~AQ
+pAMhAKx@IjDc@VAB?D@@?B?dCU`AKjAMRCPlGNtEBhABh@BVF`@D`@D\rB{@ZKDAH
+CLAHAHBHBFHFFDNHRHJHHDDHDHBF?F?VCJCJILQJUJg@HQJMJKHAFAJ?X?bCRH@R?
+AWQ?K@iBKq@GYAK@EBIFEFEFEFCFAD
+
+
+Point: Berlin Hbf, Moabit [Europaplatz 1, 10557 Berlin, Deutschl
+and]
+52.52581820000001,13.3695451
+
+
+Point: Brandenburger Tor, Pariser Platz, Berlin [Ebertstraße 21,
+ 10117 Berlin, Deutschland]
+52.5159099,13.3773202
+
+
+Point: Berlin Hbf [arrive with train]
+52.5249948,13.368988
+
+
+Point: Reichstag [nice view from the roof]
+52.5185973,13.3758974
+
+
+Point: Brandenburger Tor [once behind the wall]
+52.5163514,13.3789873
+
+
+Route: Route von Berlin Hbf, Moabit nach Pariser Platz, Berlin
+k}q_IufrpA?iFQ?@hH@H@F@B@B@?DB?\?|B@F@DB@B@~FCB?X@V??O?O?O?wF@W?o
+@?k@?Y?eAvAD`@?`@ARCFAP?hAAZ?B?D?J?B?DAJB^@T?~B?MsAAIAEAM?S@OBM?A
+@IDKBKDKFKFIJEFCJAJATAL?XAN?P?VAlBCbB?L@RB?kH@}Gp@]|@ObA?BAz@JTF^
+LZN?wF@aCE]~Am@\KREJCNANAH@HBJHHFLPP\DBFFDB@@@?D@F?JAJCKiEAQ?K@I?
+KBSXC
+
+
+Point: Berlin Hbf, Moabit [Europaplatz 1, 10557 Berlin, Deutschl
+and]
+52.52581820000001,13.3695451
+
+
+Point: Deutscher Bundestag Redaktion Das Parlament, Berlin [Plat
+z der Republik 1, 10557 Berlin, Deutschland]
+52.518502000000005,13.3751849
+
+
+Point: Pariser Platz, Berlin [Pariser Platz 1, 10117 Berlin, Deu
+tschland]
+52.5160749,13.3783013
+
+\end{lstlisting}
+% \iffalse
+%</example>
+% \fi
+%
+% Now, you can take these data for your map:
+%
+% \begin{filecontents*}{berlin2.epl}
+% &path=weight:5|color:orange|enc:k}q_IufrpA?iFQ?@hH@H@F@B@B@?DB?\?|B@F@DB@B@~FCB?X@V??O?O?O?wF@W?o@?k@?Y?eAvAD`@?`@ARCFAP?hAAZ?B?D?J?B?DAJB^@T?~B?MsAAIAEAM?S@OBM?A@IDKBKDKFKFIJEFCJAJATAL?XAN?P?VAlBCbB?L@RB?kH@}Gp@]|@ObA?BAz@JTF^LZN?wF@aCE]~Am@\KREJCNANAH@HBJHHFLPP\DBFFDB@@@?D@F?JAJCKiEAQ?K@I?KBSXC&path=weight:5|color:purple|enc:k}q_IufrpA?iFQ?gCDQBMHSm@Wq@GQIK]{AUaA}AaICIMm@Kg@EUiByIi@cDSqA_@uBIa@a@gBpB[fAMhCS|@Gd@Ev@Ep@GfAIpC[bAMr@IbAMp@G\GtBUdCSp@MrAK~AQpAMhAKx@IjDc@VAB?D@@?B?dCU`AKjAMRCPlGNtEBhABh@BVF`@D`@D\rB{@ZKDAHCLAHAHBHBFHFFDNHRHJHHDDHDHBF?F?VCJCJILQJUJg@HQJMJKHAFAJ?X?bCRH@R?AWQ?K@iBKq@GYAK@EBIFEFEFEFCFAD
% \end{filecontents*}
-% \getmap[file=berlin, mode=gm, language=de, xsize=400, ysize=600,
-% markers={&markers=size:mid|label:H|color:green|Berlin, Hbf
-% &markers=label:B|color:blue|Brandenburger Tor, Berlin},
-% pathfile={berlin.epl}]{}
-% \includegraphics[width=6cm]{berlin}
+% \getmap[file=berlin2, language=de, xsize=400, ysize=600, scale=2, mode=gm,
+% markers={&markers=size:mid|label:H|color:green|52.5249948,13.368988
+% &markers=size:mid|label:R|color:yellow|52.5185973,13.3758974
+% &markers=label:B|color:blue|52.5163514,13.3789873},
+% pathfile={berlin2.epl}]{}
+% \begin{center}\includegraphics[width=6cm]{berlin2}\end{center}
+%
% \iffalse
%<*example>
% \fi
\begin{lstlisting}
-\begin{filecontents*}{berlin.epl}
-&path=weight:5|color:purple|enc:_xq_IcgrpA?AFE@?^BFE@A^U@CLQXEZU?%
-gCR?B?DBF@@?vA?D?D?BAHE@JBN@JLGFCG[DC~C?@?F?R?vA?p@iB@i@Fe@JWRSTO%
-f@Gh@C^A?e@?gE?w@r@?lB@hA?`@??M?aA?]dI??O?O?Cn@cBfBeF|AeEHNVNBc@H%
-@H_AEwA?OAMNA@N
+\begin{filecontents*}{berlin2.epl}
+&path=weight:5|color:orange|enc:k}q_IufrpA?iFQ?@hH@H@F@B@B@?DB?\?
+|B@F@DB@B@~FCB?X@V??O?O?O?wF@W?o@?k@?Y?eAvAD`@?`@ARCFAP?hAAZ?B?D?
+J?B?DAJB^@T?~B?MsAAIAEAM?S@OBM?A@IDKBKDKFKFIJEFCJAJATAL?XAN?P?VAl
+BCbB?L@RB?kH@}Gp@]|@ObA?BAz@JTF^LZN?wF@aCE]~Am@\KREJCNANAH@HBJHHF
+LPP\DBFFDB@@@?D@F?JAJCKiEAQ?K@I?KBSXC&path=weight:5|color:purple|
+enc:k}q_IufrpA?iFQ?gCDQBMHSm@Wq@GQIK]{AUaA}AaICIMm@Kg@EUiByIi@cDS
+qA_@uBIa@a@gBpB[fAMhCS|@Gd@Ev@Ep@GfAIpC[bAMr@IbAMp@G\GtBUdCSp@MrA
+K~AQpAMhAKx@IjDc@VAB?D@@?B?dCU`AKjAMRCPlGNtEBhABh@BVF`@D`@D\rB{@Z
+KDAHCLAHAHBHBFHFFDNHRHJHHDDHDHBF?F?VCJCJILQJUJg@HQJMJKHAFAJ?X?bCR
+H@R?AWQ?K@iBKq@GYAK@EBIFEFEFEFCFAD
\end{filecontents*}
-\getmap[file=berlin, mode=gm, language=de, xsize=400, ysize=600,
-markers={&markers=size:mid|label:H|color:green|Berlin, Hbf
- &markers=label:B|color:blue|Brandenburger Tor, Berlin},
-pathfile={berlin.epl}]{}
-\includegraphics[width=6cm]{berlin}
+\getmap[file=berlin2, language=de, xsize=400, ysize=600,
+ scale=2, mode=gm,
+markers={&markers=size:mid|label:H|color:green|52.5249948,13.3689
+88
+ &markers=size:mid|label:R|color:yellow|52.5185973,13.375
+8974
+ &markers=label:B|color:blue|52.5163514,13.3789873},
+pathfile={berlin2.epl}]{}%
+\includegraphics[width=6cm]{berlin2}%
\end{lstlisting}
% \iffalse
%</example>
% \fi
%
-% Please note that the length of the URL is limited to 2048 bytes. So, there's
-% no way to support extreme long paths!
% \section{Implementation}
% \changes{v1.0}{2014/05/25}{CTAN upload}
% \changes{v1.2}{2014/07/11}{added support for Google Maps}
@@ -1589,13 +1853,16 @@ pathfile={berlin.epl}]{}
% \changes{v1.5}{2014/08/12}{added \texttt{gpx2gps} \texttt{bash} script}
% \changes{v1.6}{2014/08/16}{removed \texttt{gpx2gps} \texttt{bash} script}
% \changes{v1.6}{2014/08/16}{added \texttt{gpx2epl}, \texttt{gps2epl} and \texttt{gpx2gps} modes to \texttt{getmapdl.lua}}
+% \changes{v1.7}{2014/09/18}{added \texttt{kml2gps} and \texttt{kml2epl} modes to \texttt{getmapdl.lua}}
+% \changes{v1.7}{2014/09/18}{added multi track support for \texttt{gpx2gps} and \texttt{gpx2epl} mode}
+% \changes{v1.7}{2014/09/18}{revised \texttt{gps2epl} mode}
% \begin{macrocode}
%<*package>
% \end{macrocode}
% First, we provide the \LaTeX\ package \package{getmap}.
% \begin{macrocode}
\NeedsTeXFormat{LaTeX2e}%
-\ProvidesPackage{getmap}[2014/08/16 v1.6 getmap.sty - Josef Kleber (C) 2014]%
+\ProvidesPackage{getmap}[2014/09/18 v1.7 getmap.sty - Josef Kleber (C) 2014]%
% \end{macrocode}
% We need a few packages!
% \begin{macrocode}
diff --git a/Master/texmf-dist/doc/latex/getmap/getmap.pdf b/Master/texmf-dist/doc/latex/getmap/getmap.pdf
index bd291ed0574..fc1e7d94797 100644
--- a/Master/texmf-dist/doc/latex/getmap/getmap.pdf
+++ b/Master/texmf-dist/doc/latex/getmap/getmap.pdf
Binary files differ
diff --git a/Master/texmf-dist/scripts/getmap/getmapdl.lua b/Master/texmf-dist/scripts/getmap/getmapdl.lua
index f8dac4aa3cd..0ca4ac6bbb3 100755
--- a/Master/texmf-dist/scripts/getmap/getmapdl.lua
+++ b/Master/texmf-dist/scripts/getmap/getmapdl.lua
@@ -3,7 +3,8 @@
-- getmapdl [options]
--
-- downloads an OpenStreetMap, Google Maps or Google Street View map
--- specified by [options] or parses gpx or gps files to create encoded polylines
+-- specified by [options] or parses gpx, gps and kml files to create
+-- encoded polylines
--
-- License: LPPL
--
@@ -36,9 +37,10 @@ local FOV = ""
local PITCH = ""
local LANGUAGE = ""
local GPFILE = ""
+local KMLFILE = ""
local OFILE = "getmap"
local QUIET = "false"
-local VERSION = "v1.3 (16/08/2014)"
+local VERSION = "v1.4 (18/09/2014)"
function pversion()
print("getmapdl.lua " .. VERSION)
@@ -51,12 +53,12 @@ function phelp()
getmapdl.lua [options]
downloads an OpenStreetMap, Google Maps or Google Street View map
- specified by [options] or parses gpx or gps files to create
+ specified by [options] or parses gpx, gps and kml files to create
encoded polylines
Options:
- -m specify the mode (osm|gm|gsv|gpx2epl|gps2epl|gpx2gps)
+ -m specify the mode (osm|gm|gsv|gpx2epl|gps2epl|gpx2gps|kml2epl|kml2gps)
-l specify a location
e.g. 'Bergheimer Straße 110A, 69115 Heidelberg, Germany'
@@ -124,6 +126,10 @@ getmapdl.lua [options]
-G specify the gpx or gps file
+ kml2epl and kml2gps mode only:
+
+ -K specify the kml file
+
]])
pversion()
end
@@ -172,6 +178,13 @@ function encodeNumber(number)
return table.concat(t)
end
+function printepl(epltable)
+ local string = table.concat(epltable)
+ -- sometimes the sting contains unwanted control characters
+ local stingwithoutcontrolcharacters = string:gsub("%c", "")
+ print(stingwithoutcontrolcharacters)
+end
+
do
local newarg = {}
local i, limit = 1, #arg
@@ -242,6 +255,9 @@ do
elseif arg[i] == "-G" then
GPFILE = arg[i+1]
i = i + 1
+ elseif arg[i] == "-K" then
+ KMLFILE = arg[i+1]
+ i = i + 1
elseif arg[i] == "-o" then
OFILE = arg[i+1]
i = i + 1
@@ -264,22 +280,42 @@ if QUIET == 1 then
end
if MODE == "gpx2epl" then
- local file = io.open(GPFILE, "r")
+ local file = GPFILE
+ local name
+ local desc
local Olatitude = 0
local Olongitude = 0
local epl = {}
- io.input(file)
- while true do
- local line = io.read()
- if line == nil
- then
- break
+ for line in io.lines(file)
+ do
+ local latitude
+ local longitude
+ local encnum
+
+ if string.match(line, "<trk>") then
+ Olatitude = 0
+ Olongitude = 0
+ name = ""
+ desc = ""
+ epl = {}
end
- if string.match(line, "trkpt") then
- local latitude
- local longitude
- local encnum
+ if string.match(line, "<name") then
+ name = string.match(line, '<name>(.-)</name>')
+ if name == nil then
+ name = "Name (E)"
+ end
+ end
+ if string.match(line, "<desc") then
+ desc = string.match(line, '<desc>(.-)</desc>')
+ if desc == nil then
+ desc = ""
+ end
+ end
+ if string.match(line, "<trkseg") then
+ print("Route: " .. name .. " [" .. desc .. "]")
+ end
+ if string.match(line, "<trkpt") then
latitude = string.match(line, 'lat="(.-)"')
longitude = string.match(line, 'lon="(.-)"')
latitude = round(latitude,5)*100000
@@ -291,47 +327,64 @@ if MODE == "gpx2epl" then
Olatitude = latitude
Olongitude = longitude
end
+ if string.match(line, "</trk>") then
+ printepl(epl)
+ print("\n")
+ end
end
- local string = table.concat(epl)
- -- sometimes the sting contains unwanted control characters
- local stingwithoutcontrolcharacters = string:gsub("%c", "")
- print(stingwithoutcontrolcharacters)
os.exit(0)
end
if MODE == "gpx2gps" then
- local file = io.open(GPFILE, "r")
- io.input(file)
- while true do
- local line = io.read()
- if line == nil
- then
- break
+ local file = GPFILE
+ local name
+ local desc
+
+ for line in io.lines(file)
+ do
+ local latitude
+ local longitude
+ local encnum
+
+ if string.match(line, "<trk>") then
+ name = ""
+ desc = ""
end
- if string.match(line, "trkpt") then
- local latitude
- local longitude
+ if string.match(line, "<name") then
+ name = string.match(line, '<name>(.-)</name>')
+ if name == nil then
+ name = "Name (E)"
+ end
+ end
+ if string.match(line, "<desc") then
+ desc = string.match(line, '<desc>(.-)</desc>')
+ if desc == nil then
+ desc = ""
+ end
+ end
+ if string.match(line, "<trkseg") then
+ print("Route: " .. name .. " [" .. desc .. "]")
+ end
+ if string.match(line, "<trkpt") then
latitude = string.match(line, 'lat="(.-)"')
longitude = string.match(line, 'lon="(.-)"')
print(latitude .. "," .. longitude)
end
+ if string.match(line, "</trk>") then
+ print("\n")
+ end
end
os.exit(0)
end
if MODE == "gps2epl" then
- local file = io.open(GPFILE, "r")
+ local file = GPFILE
local Olatitude = 0
local Olongitude = 0
local epl = {}
- io.input(file)
- while true do
- local line = io.read()
- if line == nil
- then
- break
- end
+ for line in io.lines(file)
+ do
local latitude
local longitude
local encnum
@@ -345,10 +398,85 @@ if MODE == "gps2epl" then
Olatitude = latitude
Olongitude = longitude
end
- local string = table.concat(epl)
- -- sometimes the sting contains unwanted control characters
- local stingwithoutcontrolcharacters = string:gsub("%c", "")
- print(stingwithoutcontrolcharacters)
+ printepl(epl)
+ os.exit(0)
+end
+
+if MODE == "kml2gps" or MODE == "kml2epl" then
+ local file = KMLFILE
+ local name
+ local cdata
+ local cotype
+ local Olatitude = 0
+ local Olongitude = 0
+ local epl = {}
+
+ for line in io.lines(file)
+ do
+ local latitude
+ local longitide
+ local elevation
+
+ -- reset for new route
+ if string.match(line, "<Placemark>") then
+ Olatitude = 0
+ Olongitude = 0
+ cotype = nil
+ epl = {}
+ end
+ if string.match(line, "<name>") then
+ name = string.match(line, '<name>(.-)</name>')
+ if name == nil then
+ name = "Name (E)"
+ end
+ end
+ if string.match(line, "CDATA") then
+ cdata = string.match(line, 'CDATA%[(.-)%]')
+ if cdata == nil then
+ cdata = ""
+ end
+ end
+ if string.match(line, "<Point>") then
+ cotype = "point"
+ end
+ if string.match(line, "<LineString>") then
+ cotype = "route"
+ end
+ if cotype == "point" or cotype == "route" then
+ if string.match(line, "<coordinates>") then
+ local colist = string.match(line, '<coordinates>(.-)</coordinates>')
+ if cotype == "route" then
+ print("Route: " .. name)
+ else
+ print("Point: " .. name .. " [" .. cdata .. "]")
+ end
+ for cocsv in string.gmatch(colist, "%S+") do
+ longitude, latitude, altitude = cocsv:match("([^,]+),([^,]+),([^,]+)")
+ if MODE == "kml2epl" then
+ local encnum
+ if cotype == "route" then
+ latitude = round(latitude,5)*100000
+ longitude = round(longitude,5)*100000
+ encnum = encodeNumber(latitude - Olatitude)
+ table.insert(epl,encnum)
+ encnum = encodeNumber(longitude - Olongitude)
+ table.insert(epl,encnum)
+ Olatitude = latitude
+ Olongitude = longitude
+ else
+ print(latitude .. "," .. longitude)
+ end
+ else
+ print(latitude .. "," .. longitude)
+ end
+ end
+ if MODE == "kml2epl" and cotype == "route" then
+ printepl(epl)
+ end
+ print("\n")
+ end
+ end
+ end
os.exit(0)
end
diff --git a/Master/texmf-dist/tex/latex/getmap/getmap.sty b/Master/texmf-dist/tex/latex/getmap/getmap.sty
index cad23cbdd0c..041ffca259b 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/08/16 v1.6 getmap.sty - Josef Kleber (C) 2014]%
+\ProvidesPackage{getmap}[2014/09/18 v1.7 getmap.sty - Josef Kleber (C) 2014]%
\RequirePackage{xkeyval}%
\RequirePackage{stringenc}%
\RequirePackage{ifthen}%