<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="de">
	<id>https://skandinavien-wiki.net/w/index.php?action=history&amp;feed=atom&amp;title=Modul%3ACoordinates</id>
	<title>Modul:Coordinates - Versionsgeschichte</title>
	<link rel="self" type="application/atom+xml" href="https://skandinavien-wiki.net/w/index.php?action=history&amp;feed=atom&amp;title=Modul%3ACoordinates"/>
	<link rel="alternate" type="text/html" href="https://skandinavien-wiki.net/w/index.php?title=Modul:Coordinates&amp;action=history"/>
	<updated>2026-05-13T23:32:28Z</updated>
	<subtitle>Versionsgeschichte dieser Seite in skandinavien-wiki.net</subtitle>
	<generator>MediaWiki 1.39.10</generator>
	<entry>
		<id>https://skandinavien-wiki.net/w/index.php?title=Modul:Coordinates&amp;diff=9883&amp;oldid=prev</id>
		<title>Xineohp1506: 1 Version von :wikivoyage:Modul:Coordinates importiert</title>
		<link rel="alternate" type="text/html" href="https://skandinavien-wiki.net/w/index.php?title=Modul:Coordinates&amp;diff=9883&amp;oldid=prev"/>
		<updated>2023-01-19T13:03:01Z</updated>

		<summary type="html">&lt;p&gt;1 Version von &lt;a href=&quot;https://de.wikivoyage.org/wiki/Modul:Coordinates&quot; class=&quot;extiw&quot; title=&quot;wikivoyage:Modul:Coordinates&quot;&gt;wikivoyage:Modul:Coordinates&lt;/a&gt; importiert&lt;/p&gt;
&lt;table style=&quot;background-color: #fff; color: #202122;&quot; data-mw=&quot;interface&quot;&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;de&quot;&gt;
				&lt;td colspan=&quot;1&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;← Nächstältere Version&lt;/td&gt;
				&lt;td colspan=&quot;1&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;Version vom 19. Januar 2023, 15:03 Uhr&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-notice&quot; lang=&quot;de&quot;&gt;&lt;div class=&quot;mw-diff-empty&quot;&gt;(kein Unterschied)&lt;/div&gt;
&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;</summary>
		<author><name>Xineohp1506</name></author>
	</entry>
	<entry>
		<id>https://skandinavien-wiki.net/w/index.php?title=Modul:Coordinates&amp;diff=9882&amp;oldid=prev</id>
		<title>wikivoyage&gt;RolandUnger: require( &#039;strict&#039; )</title>
		<link rel="alternate" type="text/html" href="https://skandinavien-wiki.net/w/index.php?title=Modul:Coordinates&amp;diff=9882&amp;oldid=prev"/>
		<updated>2022-10-22T14:40:49Z</updated>

		<summary type="html">&lt;p&gt;require( &amp;#039;strict&amp;#039; )&lt;/p&gt;
&lt;p&gt;&lt;b&gt;Neue Seite&lt;/b&gt;&lt;/p&gt;&lt;div&gt;--[[&lt;br /&gt;
	Coordinate conversion procedures&lt;br /&gt;
	This module is intended to replace the functionality of MapSources extension&lt;br /&gt;
	Redesign of my own MapSources_math.php&lt;br /&gt;
	Designed for use both in modules and for direct invoking&lt;br /&gt;
&lt;br /&gt;
	Functions for use in modules:&lt;br /&gt;
&lt;br /&gt;
	toDec( coord, aDir, prec )&lt;br /&gt;
		returns a decimal coordinate from decimal or deg-min-sec-letter strings&lt;br /&gt;
	getDMSString( coord, prec, aDir, plus, minus, aFormat )&lt;br /&gt;
		formats a decimal/dms coordinate to a deg-min-sec-letter string&lt;br /&gt;
	getGeoLink( pattern, lat, long, plusLat, plusLong, minusLat, minusLong, prec, aFormat )&lt;br /&gt;
		converts a complete dms geographic coordinate without reapplying the toDec function&lt;br /&gt;
	getDecGeoLink( pattern, lat, long, prec )&lt;br /&gt;
		converts a complete decimal geographic coordinate without reapplying the toDec function&lt;br /&gt;
&lt;br /&gt;
	Invokable functions:&lt;br /&gt;
&lt;br /&gt;
	dec2dms( frame )&lt;br /&gt;
	dms2dec( frame )&lt;br /&gt;
	geoLink( frame )&lt;br /&gt;
&lt;br /&gt;
	Additional functions in Module:GeoData&lt;br /&gt;
]]--&lt;br /&gt;
&lt;br /&gt;
-- module import&lt;br /&gt;
-- require( &amp;#039;strict&amp;#039; )&lt;br /&gt;
local ci = require( &amp;#039;Module:Coordinates/i18n&amp;#039; )&lt;br /&gt;
&lt;br /&gt;
-- module variable and administration&lt;br /&gt;
local cd = {&lt;br /&gt;
	moduleInterface = {&lt;br /&gt;
		suite  = &amp;#039;Coordinates&amp;#039;,&lt;br /&gt;
		serial = &amp;#039;2022-10-22&amp;#039;,&lt;br /&gt;
		item   = 7348344&lt;br /&gt;
	}&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
-- helper function getErrorMsg&lt;br /&gt;
-- returns error message by error number which&lt;br /&gt;
local function getErrorMsg( which )&lt;br /&gt;
	if which == &amp;#039;noError&amp;#039; or which == 0 then&lt;br /&gt;
		return ci.errorMsg.noError&lt;br /&gt;
	elseif which &amp;gt; #ci.errorMsg then&lt;br /&gt;
		return ci.errorMsg.unknown&lt;br /&gt;
	else&lt;br /&gt;
		return ci.errorMsg[ which ]&lt;br /&gt;
	end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
-- helper function round&lt;br /&gt;
-- num: value to round&lt;br /&gt;
-- idp: number of digits after the decimal point&lt;br /&gt;
local function round( n, idp )&lt;br /&gt;
	local m = 10^( idp or 0 )&lt;br /&gt;
	if n &amp;gt;= 0 then&lt;br /&gt;
		return math.floor( n * m + 0.5 ) / m&lt;br /&gt;
	else&lt;br /&gt;
		return math.ceil( n * m - 0.5 ) / m&lt;br /&gt;
	end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
-- helper function getPrecision&lt;br /&gt;
-- returns integer precision number&lt;br /&gt;
-- possible values: numbers, D, DM, DMS&lt;br /&gt;
-- default result: 4&lt;br /&gt;
local function getPrecision( prec )&lt;br /&gt;
	local p = tonumber( prec )&lt;br /&gt;
	if p then&lt;br /&gt;
		p = round( p, 0 )&lt;br /&gt;
		if p &amp;lt; -1 then&lt;br /&gt;
			p = -1&lt;br /&gt;
		elseif p &amp;gt; 8 then -- maximum 8 decimals&lt;br /&gt;
			p = 8&lt;br /&gt;
		end&lt;br /&gt;
		return p&lt;br /&gt;
	else&lt;br /&gt;
		p = prec and prec:upper() or &amp;#039;DMS&amp;#039;&lt;br /&gt;
		if p == &amp;#039;D&amp;#039; then&lt;br /&gt;
			return 0&lt;br /&gt;
		elseif p == &amp;#039;DM&amp;#039; then&lt;br /&gt;
			return 2&lt;br /&gt;
		else&lt;br /&gt;
			return 4 -- DMS = default&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
-- helper function toDMS&lt;br /&gt;
-- splits a decimal coordinate dec to degree, minute and second depending on the&lt;br /&gt;
-- precision. prec &amp;lt;= 0 means only degree, prec &amp;lt; 3 degree and minute, and so on&lt;br /&gt;
-- returns a result array&lt;br /&gt;
local function toDMS( dec, prec )&lt;br /&gt;
	local result = { dec = 0, deg = 0, min = 0, sec = 0, sign = 1,&lt;br /&gt;
		NS = &amp;#039;N&amp;#039;, EW = &amp;#039;E&amp;#039;, prec = getPrecision( prec ) }&lt;br /&gt;
	local p = result.prec&lt;br /&gt;
	&lt;br /&gt;
	result.dec = round( dec, 8 )&lt;br /&gt;
	if result.dec &amp;lt; 0 then &lt;br /&gt;
		result.sign = -1&lt;br /&gt;
		result.NS = &amp;#039;S&amp;#039;&lt;br /&gt;
		result.EW = &amp;#039;W&amp;#039;&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	local angle = math.abs( round( result.dec, p ) )&lt;br /&gt;
	result.deg = math.floor( angle )&lt;br /&gt;
	result.min = ( angle - result.deg ) * 60&lt;br /&gt;
&lt;br /&gt;
	if p &amp;gt; 4 then&lt;br /&gt;
		result.sec = round( ( result.min - math.floor( result.min ) ) * 60, p - 4 )&lt;br /&gt;
	else&lt;br /&gt;
		result.sec = round( ( result.min - math.floor( result.min ) ) * 60 )&lt;br /&gt;
	end&lt;br /&gt;
	result.min = math.floor( result.min )&lt;br /&gt;
	&lt;br /&gt;
	if result.sec &amp;gt;= 60 then&lt;br /&gt;
		result.sec = result.sec - 60&lt;br /&gt;
		result.min = result.min + 1 &lt;br /&gt;
	end&lt;br /&gt;
	if p &amp;lt; 3 and result.sec &amp;gt;= 30 then&lt;br /&gt;
		result.min = result.min + 1&lt;br /&gt;
	end&lt;br /&gt;
	if p &amp;lt; 3 then&lt;br /&gt;
		result.sec = 0&lt;br /&gt;
	end&lt;br /&gt;
	if result.min &amp;gt;= 60 then&lt;br /&gt;
		result.min = result.min - 60&lt;br /&gt;
		result.deg = result.deg + 1&lt;br /&gt;
	end&lt;br /&gt;
	if p &amp;lt; 1 and result.min &amp;gt;= 30 then&lt;br /&gt;
		result.deg = result.deg + 1&lt;br /&gt;
	end&lt;br /&gt;
	if p &amp;lt; 1 then&lt;br /&gt;
		result.min = 0&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	return result&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
-- toDec converts decimal and hexagesimal DMS formatted coordinates to decimal&lt;br /&gt;
-- coordinates&lt;br /&gt;
-- input&lt;br /&gt;
--  dec: coordinate&lt;br /&gt;
--  prec: number of digits after the decimal point&lt;br /&gt;
--  aDir: lat/long directions&lt;br /&gt;
-- returns a result array&lt;br /&gt;
-- output&lt;br /&gt;
--  dec: decimal value&lt;br /&gt;
--  error: error number&lt;br /&gt;
--  parts: number of DMS parts, usually 1 (already decimal) ... 4&lt;br /&gt;
function cd.toDec( coord, aDir, prec )&lt;br /&gt;
	local result = { dec = 0, error = 0, parts = 1 }&lt;br /&gt;
&lt;br /&gt;
	local s = mw.text.trim( coord )&lt;br /&gt;
	if s == &amp;#039;&amp;#039; then&lt;br /&gt;
		result.error = 1&lt;br /&gt;
		return result&lt;br /&gt;
	end&lt;br /&gt;
	&lt;br /&gt;
	-- pretest if already a decimal&lt;br /&gt;
	local dir = aDir or &amp;#039;&amp;#039;&lt;br /&gt;
	local mx = dir == &amp;#039;lat&amp;#039; and 90 or 180&lt;br /&gt;
	local r = tonumber( s )&lt;br /&gt;
	if r then&lt;br /&gt;
		if r &amp;lt; -mx or r &amp;gt; mx or r &amp;lt;= -180 then&lt;br /&gt;
			result.error = 5&lt;br /&gt;
			return result&lt;br /&gt;
		end&lt;br /&gt;
		result.dec = round( r, getPrecision ( prec ) )&lt;br /&gt;
		return result&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	s = mw.ustring.gsub( s, &amp;#039;[‘’′´`]&amp;#039;, &amp;quot;&amp;#039;&amp;quot; )&lt;br /&gt;
	s = s:gsub( &amp;quot;&amp;#039;&amp;#039;&amp;quot;, &amp;#039;&amp;quot;&amp;#039; )&lt;br /&gt;
	s = mw.ustring.gsub( s, &amp;#039;[“”″]&amp;#039;, &amp;#039;&amp;quot;&amp;#039; )&lt;br /&gt;
	s = mw.ustring.gsub( s, &amp;#039;[−–—]&amp;#039;, &amp;#039;-&amp;#039; )&lt;br /&gt;
	s = mw.ustring.upper( mw.ustring.gsub( s, &amp;#039;[_/%c%s%z]&amp;#039;, &amp;#039; &amp;#039; ) )&lt;br /&gt;
	local mStr = &amp;#039;^[ %.%-°\&amp;#039;&amp;quot;0-9&amp;#039; -- string to match, illegal characters?&lt;br /&gt;
	for key, value in pairs( ci.inputLetters ) do&lt;br /&gt;
		mStr = mStr .. key&lt;br /&gt;
	end&lt;br /&gt;
	mStr = mStr .. &amp;#039;]+$&amp;#039;&lt;br /&gt;
	if not mw.ustring.match( s, mStr ) then&lt;br /&gt;
		result.error = 3&lt;br /&gt;
		return result&lt;br /&gt;
	end	&lt;br /&gt;
	s = mw.ustring.gsub( s, &amp;#039;(%u)&amp;#039;, &amp;#039; %1&amp;#039; )&lt;br /&gt;
	s = mw.ustring.gsub( s, &amp;#039;%s*([°&amp;quot;\&amp;#039;])&amp;#039;, &amp;#039;%1 &amp;#039; )&lt;br /&gt;
	s = mw.text.split( s, &amp;#039;%s&amp;#039; )&lt;br /&gt;
	for i = #s, 1, -1 do&lt;br /&gt;
		if mw.text.trim( s[ i ] ) == &amp;#039;&amp;#039; then&lt;br /&gt;
			table.remove( s, i )&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
	result.parts = #s&lt;br /&gt;
&lt;br /&gt;
	if #s &amp;lt; 1 or #s &amp;gt; 4 then&lt;br /&gt;
		result.error = 2&lt;br /&gt;
		return result&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	local units = { &amp;#039;°&amp;#039;, &amp;quot;&amp;#039;&amp;quot;, &amp;#039;&amp;quot;&amp;#039;, &amp;#039; &amp;#039; }&lt;br /&gt;
	local res   = { 0, 0, 0, 1 } -- 1 = positive direction&lt;br /&gt;
&lt;br /&gt;
	local v&lt;br /&gt;
	local l&lt;br /&gt;
	for i = 1, #s, 1 do&lt;br /&gt;
		v = mw.ustring.gsub( s[ i ], units[ i ], &amp;#039;&amp;#039; )&lt;br /&gt;
&lt;br /&gt;
		if tonumber( v ) then&lt;br /&gt;
			if i &amp;gt; 3 then -- this position is for direction letter, not for number&lt;br /&gt;
				result.error = 4&lt;br /&gt;
				return result&lt;br /&gt;
			end&lt;br /&gt;
&lt;br /&gt;
			v = tonumber( v )&lt;br /&gt;
			if i == 1 then&lt;br /&gt;
				if v &amp;lt; -mx or v &amp;gt; mx then&lt;br /&gt;
					result.error = 5&lt;br /&gt;
					return result&lt;br /&gt;
				end&lt;br /&gt;
				res[ 1 ] = v&lt;br /&gt;
			elseif i == 2 or i == 3 then&lt;br /&gt;
				if v &amp;lt; 0 or v &amp;gt;= 60 then&lt;br /&gt;
					result.error = 2 + 2 * i&lt;br /&gt;
					return result&lt;br /&gt;
				end&lt;br /&gt;
				if res[ i - 1 ] ~= round( res[ i - 1 ], 0 ) then&lt;br /&gt;
					result.error = 3 + 2 * i&lt;br /&gt;
					return result&lt;br /&gt;
				end&lt;br /&gt;
				res[ i ] = v&lt;br /&gt;
			end&lt;br /&gt;
		else -- no number&lt;br /&gt;
			if i ~= #s then -- allowed only at the last position&lt;br /&gt;
				result.error = 10&lt;br /&gt;
				return result&lt;br /&gt;
			end&lt;br /&gt;
			if res[ 1 ] &amp;lt; 0 then&lt;br /&gt;
				result.error = 11&lt;br /&gt;
				return result&lt;br /&gt;
			end&lt;br /&gt;
			l = ci.inputLetters[ v ]&lt;br /&gt;
			if mw.ustring.len( v ) ~= 1 or not l then&lt;br /&gt;
				result.error = 3&lt;br /&gt;
				return result&lt;br /&gt;
			end&lt;br /&gt;
&lt;br /&gt;
			-- l[1]: factor&lt;br /&gt;
			-- l[2]: lat/long&lt;br /&gt;
			if ( dir == &amp;#039;long&amp;#039; and l[ 2 ] ~= &amp;#039;long&amp;#039; ) or&lt;br /&gt;
				( dir == &amp;#039;lat&amp;#039; and l[ 2 ] ~= &amp;#039;lat&amp;#039; ) then&lt;br /&gt;
				result.error = 12&lt;br /&gt;
				return result&lt;br /&gt;
			else&lt;br /&gt;
				dir = l[ 2 ]&lt;br /&gt;
			end&lt;br /&gt;
&lt;br /&gt;
			res[ 4 ] = l[ 1 ]&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	if res[ 1 ] &amp;gt;= 0 then&lt;br /&gt;
		result.dec = ( res[ 1 ] + res[ 2 ] / 60 + res[ 3 ] / 3600 ) * res[ 4 ]&lt;br /&gt;
	else&lt;br /&gt;
		result.dec = ( res[ 1 ] - res[ 2 ] / 60 - res[ 3 ] / 3600 ) * res[ 4 ]&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	result.dec = round( result.dec, getPrecision ( prec ) )&lt;br /&gt;
	if result.dec &amp;lt; -mx or result.dec &amp;gt; mx or result.dec &amp;lt;= -180 then&lt;br /&gt;
		result.error = 5&lt;br /&gt;
		return result&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	return result&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
-- getDMSString formats a degree-minute-second string for output in accordance&lt;br /&gt;
-- to a given format specification&lt;br /&gt;
-- input&lt;br /&gt;
--  coord: decimal or hexagesimal DMS coordinate&lt;br /&gt;
--  prec: precion of the coorninate string: D, DM, DMS&lt;br /&gt;
--  aDir: lat/long direction to add correct direction letters&lt;br /&gt;
--  plus: alternative direction string for positive directions&lt;br /&gt;
--  minus: alternative direction string for negative directions&lt;br /&gt;
--  aFormat: format array with delimiter and leadZeros values or a predefined&lt;br /&gt;
--  dmsFormats key. Default format key is f1.&lt;br /&gt;
-- outputs 3 results&lt;br /&gt;
--  1: formatted string or error message for display&lt;br /&gt;
--  2: decimal coordinate&lt;br /&gt;
--  3: absolute decimal coordinate including the direction letter like 51.2323_N&lt;br /&gt;
function cd.getDMSString( coord, prec, aDir, aPlus, aMinus, aFormat )&lt;br /&gt;
	local d = aDir or &amp;#039;&amp;#039;&lt;br /&gt;
	local p = aPlus or &amp;#039;&amp;#039;&lt;br /&gt;
	local m = aMinus or &amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
	-- format&lt;br /&gt;
	local f = aFormat or &amp;#039;f1&amp;#039;&lt;br /&gt;
	if type( f ) ~= &amp;#039;table&amp;#039; then&lt;br /&gt;
		f = ci.dmsFormats[ f ]&lt;br /&gt;
	end&lt;br /&gt;
	local del = f.delimiter or &amp;#039; &amp;#039;&lt;br /&gt;
	local lz = f.leadZeros or false&lt;br /&gt;
&lt;br /&gt;
	local c = { dec = tonumber( coord ), error = 0, parts = 1 } &lt;br /&gt;
	if not c.dec then&lt;br /&gt;
		c = cd.toDec( coord, d, 8 )&lt;br /&gt;
	elseif c.dec &amp;lt;= -180 or c.dec &amp;gt; 180 then&lt;br /&gt;
		c.error = 5&lt;br /&gt;
	elseif d == &amp;#039;lat&amp;#039; and ( c.dec &amp;lt; -90 or c.dec &amp;gt; 90 ) then&lt;br /&gt;
		c.error = 5 &lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	local l = &amp;#039;&amp;#039;&lt;br /&gt;
	local wp = &amp;#039;&amp;#039;&lt;br /&gt;
	local result = &amp;#039;&amp;#039;&lt;br /&gt;
	if c.error == 0 then&lt;br /&gt;
		local dms = toDMS( c.dec, prec )&lt;br /&gt;
		if dms.dec &amp;lt; 0 and d == &amp;#039;&amp;#039; and m == &amp;#039;&amp;#039; then&lt;br /&gt;
			dms.deg = -dms.deg&lt;br /&gt;
		end&lt;br /&gt;
&lt;br /&gt;
		if lz and dms.min &amp;lt; 10 then&lt;br /&gt;
			dms.min = &amp;#039;0&amp;#039; .. dms.min&lt;br /&gt;
		end&lt;br /&gt;
		if lz and dms.sec &amp;lt; 10 then&lt;br /&gt;
			dms.sec = &amp;#039;0&amp;#039; .. dms.sec&lt;br /&gt;
		end&lt;br /&gt;
		result = dms.deg .. &amp;#039;°&amp;#039;&lt;br /&gt;
		if dms.prec &amp;gt; 0 then&lt;br /&gt;
			result = result .. del .. dms.min .. &amp;#039;′&amp;#039;&lt;br /&gt;
		end&lt;br /&gt;
		if dms.prec &amp;gt; 2 and dms.prec &amp;lt; 5 then&lt;br /&gt;
			result = result .. del .. dms.sec .. &amp;#039;″&amp;#039;&lt;br /&gt;
		end&lt;br /&gt;
		if dms.prec &amp;gt; 4 then &lt;br /&gt;
			-- enforce sec decimal digits even if zero&lt;br /&gt;
			local s = string.format( &amp;quot;%.&amp;quot; .. dms.prec - 4 .. &amp;quot;f″&amp;quot;, dms.sec )&lt;br /&gt;
			if ci.decimalPoint ~= &amp;#039;.&amp;#039; then &lt;br /&gt;
				s = mw.ustring.gsub( s, &amp;#039;%.&amp;#039;, ci.decimalPoint )&lt;br /&gt;
			end&lt;br /&gt;
			result = result .. del .. s&lt;br /&gt;
		end&lt;br /&gt;
		&lt;br /&gt;
		if d == &amp;#039;lat&amp;#039; then&lt;br /&gt;
			wp = dms.NS&lt;br /&gt;
		elseif d == &amp;#039;long&amp;#039; then&lt;br /&gt;
			wp = dms.EW&lt;br /&gt;
		end&lt;br /&gt;
		if dms.dec &amp;gt;= 0 and p ~= &amp;#039;&amp;#039; then&lt;br /&gt;
			l = p&lt;br /&gt;
		elseif dms.dec &amp;lt; 0 and m ~= &amp;#039;&amp;#039; then&lt;br /&gt;
			l = m&lt;br /&gt;
		else&lt;br /&gt;
			l = ci.outputLetters[ wp ]&lt;br /&gt;
		end&lt;br /&gt;
&lt;br /&gt;
		if l and l ~= &amp;#039;&amp;#039; then&lt;br /&gt;
			result = result .. del .. l&lt;br /&gt;
		end&lt;br /&gt;
		if c.parts &amp;gt; 1 then&lt;br /&gt;
			result = result .. ci.categories.dms&lt;br /&gt;
		end&lt;br /&gt;
		&lt;br /&gt;
		return result, dms.dec, math.abs( dms.dec ) .. &amp;#039;_&amp;#039; .. wp&lt;br /&gt;
	else&lt;br /&gt;
		if d == &amp;#039;lat&amp;#039; then&lt;br /&gt;
			wp = &amp;#039;N&amp;#039;&lt;br /&gt;
		elseif d == &amp;#039;long&amp;#039; then&lt;br /&gt;
			wp = &amp;#039;E&amp;#039;&lt;br /&gt;
		end&lt;br /&gt;
		result = &amp;#039;&amp;lt;span class=&amp;quot;error&amp;quot; title=&amp;quot;&amp;#039; .. getErrorMsg( c.error ) ..&amp;#039;&amp;quot;&amp;gt;&amp;#039;&lt;br /&gt;
			.. ci.errorMsg.faulty .. &amp;#039;&amp;lt;/span&amp;gt;&amp;#039; .. ci.categories.faulty&lt;br /&gt;
		return result, &amp;#039;0&amp;#039;, &amp;#039;0_&amp;#039; .. wp&lt;br /&gt;
	end&lt;br /&gt;
	return result	&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
-- getGeoLink returns complete dms geographic coordinate without reapplying the toDec&lt;br /&gt;
-- and toDMS functions. Pattern can contain placeholders $1 ... $6&lt;br /&gt;
--  $1: latitude in Wikipedia syntax including the direction letter like 51.2323_N&lt;br /&gt;
--  $2: longitude in Wikipedia syntax including the direction letter like 51.2323_E&lt;br /&gt;
--  $3: latitude in degree, minute and second format considering the strings for&lt;br /&gt;
--      the cardinal directions and the precision&lt;br /&gt;
--  $4: longitude in degree, minute and second format considering the strings&lt;br /&gt;
--      for the cardinal directions and the precision&lt;br /&gt;
--  $5: latitude&lt;br /&gt;
--  $6: longitude&lt;br /&gt;
-- aFormat: format array with delimiter and leadZeros values or a predefined&lt;br /&gt;
-- dmsFormats key. Default format key is f1.&lt;br /&gt;
-- outputs 3 results&lt;br /&gt;
--  1: formatted string or error message for display&lt;br /&gt;
--  2: decimal latitude&lt;br /&gt;
--  3: decimal longitude&lt;br /&gt;
function cd.getGeoLink( pattern, lat, long, plusLat, plusLong, minusLat,&lt;br /&gt;
	minusLong, prec, aFormat )&lt;br /&gt;
	local lat_s, lat_dec, lat_wp =&lt;br /&gt;
		cd.getDMSString( lat, prec, &amp;#039;lat&amp;#039;, plusLat, minusLat, aFormat )&lt;br /&gt;
	local long_s, long_dec, long_wp =&lt;br /&gt;
		cd.getDMSString( long, prec, &amp;#039;long&amp;#039;, plusLong, minusLong, aFormat )&lt;br /&gt;
		&lt;br /&gt;
	local s = pattern&lt;br /&gt;
	s = mw.ustring.gsub( s, &amp;#039;($1)&amp;#039;, lat_wp )&lt;br /&gt;
	s = mw.ustring.gsub( s, &amp;#039;($2)&amp;#039;, long_wp )&lt;br /&gt;
	s = mw.ustring.gsub( s, &amp;#039;($3)&amp;#039;, lat_s )&lt;br /&gt;
	s = mw.ustring.gsub( s, &amp;#039;($4)&amp;#039;, long_s )&lt;br /&gt;
	s = mw.ustring.gsub( s, &amp;#039;($5)&amp;#039;, lat_dec )&lt;br /&gt;
	s = mw.ustring.gsub( s, &amp;#039;($6)&amp;#039;, long_dec )&lt;br /&gt;
	&lt;br /&gt;
	return s, lat_dec, long_dec&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
-- getDecGeoLink returns complete decimal geographic coordinate without reapplying&lt;br /&gt;
-- the toDec function. Pattern can contain placeholders $1 ... $4&lt;br /&gt;
function cd.getDecGeoLink( pattern, lat, long, prec )&lt;br /&gt;
&lt;br /&gt;
	local function getDec( coord, prec, aDir, aPlus, aMinus )&lt;br /&gt;
		local l = aPlus&lt;br /&gt;
		local c = cd.toDec( coord, aDir, 8 )&lt;br /&gt;
		if c.error == 0 then&lt;br /&gt;
			if c.dec &amp;lt; 0 then&lt;br /&gt;
				l = aMinus&lt;br /&gt;
			end&lt;br /&gt;
			local d = round( c.dec, prec ) .. &amp;#039;&amp;#039;&lt;br /&gt;
			if ci.decimalPoint ~= &amp;#039;.&amp;#039; then &lt;br /&gt;
				d = mw.ustring.gsub( d, &amp;#039;%.&amp;#039;, ci.decimalPoint )&lt;br /&gt;
			end&lt;br /&gt;
			return d, math.abs( c.dec ) .. &amp;#039;_&amp;#039; .. l&lt;br /&gt;
		else&lt;br /&gt;
			c.dec = &amp;#039;&amp;lt;span class=&amp;quot;error&amp;quot; title=&amp;quot;&amp;#039; .. getErrorMsg( c.error ) ..&amp;#039;&amp;quot;&amp;gt;&amp;#039;&lt;br /&gt;
				.. ci.errorMsg.faulty .. &amp;#039;&amp;lt;/span&amp;gt;&amp;#039; .. ci.categories.faulty&lt;br /&gt;
			return c.dec, &amp;#039;0_&amp;#039; .. l&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	local lat_dec, lat_wp = getDec( lat, prec, &amp;#039;lat&amp;#039;, &amp;#039;N&amp;#039;, &amp;#039;S&amp;#039; )&lt;br /&gt;
	local long_dec, long_wp = getDec( long, prec, &amp;#039;long&amp;#039;, &amp;#039;E&amp;#039;, &amp;#039;W&amp;#039; )&lt;br /&gt;
&lt;br /&gt;
	local s = pattern&lt;br /&gt;
	s = mw.ustring.gsub( s, &amp;#039;($1)&amp;#039;, lat_wp)&lt;br /&gt;
	s = mw.ustring.gsub( s, &amp;#039;($2)&amp;#039;, long_wp)&lt;br /&gt;
	s = mw.ustring.gsub( s, &amp;#039;($3)&amp;#039;, lat_dec)&lt;br /&gt;
	s = mw.ustring.gsub( s, &amp;#039;($4)&amp;#039;, long_dec)&lt;br /&gt;
&lt;br /&gt;
	return s, lat_dec, long_dec&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
-- Invokable functions&lt;br /&gt;
&lt;br /&gt;
-- identical to MapSources #dd2dms tag&lt;br /&gt;
-- frame input&lt;br /&gt;
--  1 or coord: decimal or hexagesimal coordinate&lt;br /&gt;
--  precision: precion of the coorninate string: D, DM, DMS&lt;br /&gt;
--  plus: alternative direction string for positive directions&lt;br /&gt;
--  minus: alternative direction string for negative directions&lt;br /&gt;
--  format: Predefined dmsFormats key. Default format key is f1.&lt;br /&gt;
function cd.dec2dms( frame )&lt;br /&gt;
	local args     = frame:getParent().args&lt;br /&gt;
	args.coord     = args[ 1 ] or args.coord or &amp;#039;&amp;#039;&lt;br /&gt;
	args.precision = args.precision or &amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
	local r, dec, absol = cd.getDMSString( args.coord, args.precision, &amp;#039;&amp;#039;,&lt;br /&gt;
		args.plus, args.minus, args.format )&lt;br /&gt;
	return r&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
-- identical to MapSources #deg2dd tag&lt;br /&gt;
function cd.dms2dec( frame )&lt;br /&gt;
	local args     = frame:getParent().args&lt;br /&gt;
	args.coord     = args[ 1 ] or args.coord or &amp;#039;&amp;#039;&lt;br /&gt;
	args.precision = args.precision or &amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
	local r = cd.toDec( args.coord, &amp;#039;&amp;#039;, args.precision )&lt;br /&gt;
	local s = r.dec&lt;br /&gt;
	if r.error ~= 0 then&lt;br /&gt;
		s = &amp;#039;&amp;lt;span class=&amp;quot;error&amp;quot; title=&amp;quot;&amp;#039; .. getErrorMsg( r.error ) ..&amp;#039;&amp;quot;&amp;gt;&amp;#039;&lt;br /&gt;
			.. ci.errorMsg.faulty .. &amp;#039;&amp;lt;/span&amp;gt;&amp;#039; .. ci.categories.faulty&lt;br /&gt;
	end&lt;br /&gt;
	return s&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
-- identical to MapSources #geoLink tag&lt;br /&gt;
-- This function can be extended to add Extension:GeoData #coordinates because&lt;br /&gt;
-- cd.getGeoLink returns lat and long, too&lt;br /&gt;
function cd.geoLink( frame )&lt;br /&gt;
	local args   = frame:getParent().args&lt;br /&gt;
	args.pattern = args[ 1 ] or args.pattern or &amp;#039;&amp;#039;&lt;br /&gt;
	if args.pattern == &amp;#039;&amp;#039; then&lt;br /&gt;
		return errorMsg[ 14 ]&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	return cd.getGeoLink( args.pattern, args.lat, args.long,&lt;br /&gt;
		args.plusLat, args.plusLong, args.minusLat, args.minusLong,&lt;br /&gt;
		args.precision, args.format )&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
return cd&lt;/div&gt;</summary>
		<author><name>wikivoyage&gt;RolandUnger</name></author>
	</entry>
</feed>