<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://wonkpedia.org/mediawiki/index.php?action=history&amp;feed=atom&amp;title=Module%3ALocation_map</id>
	<title>Module:Location map - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://wonkpedia.org/mediawiki/index.php?action=history&amp;feed=atom&amp;title=Module%3ALocation_map"/>
	<link rel="alternate" type="text/html" href="https://wonkpedia.org/mediawiki/index.php?title=Module:Location_map&amp;action=history"/>
	<updated>2026-04-15T05:59:01Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.35.13</generator>
	<entry>
		<id>https://wonkpedia.org/mediawiki/index.php?title=Module:Location_map&amp;diff=1650&amp;oldid=prev</id>
		<title>Bmueller: 1 revision imported</title>
		<link rel="alternate" type="text/html" href="https://wonkpedia.org/mediawiki/index.php?title=Module:Location_map&amp;diff=1650&amp;oldid=prev"/>
		<updated>2022-02-23T23:47:15Z</updated>

		<summary type="html">&lt;p&gt;1 revision imported&lt;/p&gt;
&lt;table class=&quot;diff diff-contentalign-left diff-editfont-monospace&quot; data-mw=&quot;interface&quot;&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;en&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;Revision as of 23:47, 23 February 2022&lt;/td&gt;
				&lt;/tr&gt;
&lt;!-- diff cache key lets_get_wonky-mediawiki-:diff:wikidiff2:1.12:old-1649:rev-1650:1.11.0 --&gt;
&lt;/table&gt;</summary>
		<author><name>Bmueller</name></author>
	</entry>
	<entry>
		<id>https://wonkpedia.org/mediawiki/index.php?title=Module:Location_map&amp;diff=1649&amp;oldid=prev</id>
		<title>Wikipedia&gt;Elli: from sandbox, use phab:T301588&quot;notpageimage&quot; class to avoid these maps being used as preview images, which is not desirable. this seemed to not cause any issues with the testcases here, but feel free to revert immediately if this causes any issues</title>
		<link rel="alternate" type="text/html" href="https://wonkpedia.org/mediawiki/index.php?title=Module:Location_map&amp;diff=1649&amp;oldid=prev"/>
		<updated>2022-02-20T02:54:00Z</updated>

		<summary type="html">&lt;p&gt;&lt;a href=&quot;/mediawiki/index.php/Special:PermanentLink/1072912074&quot; title=&quot;Special:PermanentLink/1072912074&quot;&gt;from sandbox&lt;/a&gt;, use &lt;a href=&quot;/mediawiki/index.php?title=Phab:T301588%22notpageimage%22_class&amp;amp;action=edit&amp;amp;redlink=1&quot; class=&quot;new&quot; title=&quot;Phab:T301588&amp;quot;notpageimage&amp;quot; class (page does not exist)&quot;&gt;phab:T301588&amp;quot;notpageimage&amp;quot; class&lt;/a&gt; to avoid these maps being used as preview images, which is not desirable. this seemed to not cause any issues with the testcases &lt;a href=&quot;/mediawiki/index.php?title=Template:Location_map/testcases&amp;amp;action=edit&amp;amp;redlink=1&quot; class=&quot;new&quot; title=&quot;Template:Location map/testcases (page does not exist)&quot;&gt;here&lt;/a&gt;, but feel free to revert immediately if this causes any issues&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;require('Module:No globals')&lt;br /&gt;
&lt;br /&gt;
local p = {}&lt;br /&gt;
&lt;br /&gt;
local getArgs = require('Module:Arguments').getArgs&lt;br /&gt;
&lt;br /&gt;
local function round(n, decimals)&lt;br /&gt;
	local pow = 10^(decimals or 0)&lt;br /&gt;
	return math.floor(n * pow + 0.5) / pow&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
function p.getMapParams(map, frame)&lt;br /&gt;
	if not map then&lt;br /&gt;
		error('The name of the location map definition to use must be specified', 2)&lt;br /&gt;
	end&lt;br /&gt;
	local moduletitle = mw.title.new('Module:Location map/data/' .. map)&lt;br /&gt;
	if not moduletitle then&lt;br /&gt;
		error(string.format('%q is not a valid name for a location map definition', map), 2)&lt;br /&gt;
	elseif moduletitle.exists then&lt;br /&gt;
		local mapData = mw.loadData('Module:Location map/data/' .. map)&lt;br /&gt;
		return function(name, params)&lt;br /&gt;
			if name == nil then&lt;br /&gt;
				return 'Module:Location map/data/' .. map&lt;br /&gt;
			elseif mapData[name] == nil then&lt;br /&gt;
				return ''&lt;br /&gt;
			elseif params then&lt;br /&gt;
				return mw.message.newRawMessage(tostring(mapData[name]), unpack(params)):plain()&lt;br /&gt;
			else&lt;br /&gt;
				return mapData[name]&lt;br /&gt;
			end&lt;br /&gt;
		end&lt;br /&gt;
	else&lt;br /&gt;
		error('Unable to find the specified location map definition: &amp;quot;Module:Location map/data/' .. map .. '&amp;quot; does not exist', 2)&lt;br /&gt;
	end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
function p.data(frame, args, map)&lt;br /&gt;
	if not args then&lt;br /&gt;
		args = getArgs(frame, {frameOnly = true})&lt;br /&gt;
	end&lt;br /&gt;
	if not map then&lt;br /&gt;
		map = p.getMapParams(args[1], frame)&lt;br /&gt;
	end&lt;br /&gt;
	local params = {}&lt;br /&gt;
	for k,v in ipairs(args) do&lt;br /&gt;
		if k &amp;gt; 2 then&lt;br /&gt;
			params[k-2] = v&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
	return map(args[2], #params ~= 0 and params)&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
local hemisphereMultipliers = {&lt;br /&gt;
	longitude = { W = -1, w = -1, E = 1, e = 1 },&lt;br /&gt;
	latitude = { S = -1, s = -1, N = 1, n = 1 }&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
local function decdeg(degrees, minutes, seconds, hemisphere, decimal, direction)&lt;br /&gt;
	if decimal then&lt;br /&gt;
		if degrees then&lt;br /&gt;
			error('Decimal and DMS degrees cannot both be provided for ' .. direction, 2)&lt;br /&gt;
		elseif minutes then&lt;br /&gt;
			error('Minutes can only be provided with DMS degrees for ' .. direction, 2)&lt;br /&gt;
		elseif seconds then&lt;br /&gt;
			error('Seconds can only be provided with DMS degrees for ' .. direction, 2)&lt;br /&gt;
		elseif hemisphere then&lt;br /&gt;
			error('A hemisphere can only be provided with DMS degrees for ' .. direction, 2)&lt;br /&gt;
		end&lt;br /&gt;
		local retval = tonumber(decimal)&lt;br /&gt;
		if retval then&lt;br /&gt;
			return retval&lt;br /&gt;
		end&lt;br /&gt;
		error('The value &amp;quot;' .. decimal .. '&amp;quot; provided for ' .. direction .. ' is not valid', 2)&lt;br /&gt;
	elseif seconds and not minutes then&lt;br /&gt;
		error('Seconds were provided for ' .. direction .. ' without minutes also being provided', 2)&lt;br /&gt;
	elseif not degrees then&lt;br /&gt;
		if minutes then&lt;br /&gt;
			error('Minutes were provided for ' .. direction .. ' without degrees also being provided', 2)&lt;br /&gt;
		elseif hemisphere then&lt;br /&gt;
			error('A hemisphere was provided for ' .. direction .. ' without degrees also being provided', 2)&lt;br /&gt;
		end&lt;br /&gt;
		return nil&lt;br /&gt;
	end&lt;br /&gt;
	decimal = tonumber(degrees)&lt;br /&gt;
	if not decimal then&lt;br /&gt;
		error('The degree value &amp;quot;' .. degrees .. '&amp;quot; provided for ' .. direction .. ' is not valid', 2)&lt;br /&gt;
	elseif minutes and not tonumber(minutes) then&lt;br /&gt;
		error('The minute value &amp;quot;' .. minutes .. '&amp;quot; provided for ' .. direction .. ' is not valid', 2)&lt;br /&gt;
	elseif seconds and not tonumber(seconds) then&lt;br /&gt;
		error('The second value &amp;quot;' .. seconds .. '&amp;quot; provided for ' .. direction .. ' is not valid', 2)&lt;br /&gt;
	end&lt;br /&gt;
	decimal = decimal + (minutes or 0)/60 + (seconds or 0)/3600&lt;br /&gt;
	if hemisphere then&lt;br /&gt;
		local multiplier = hemisphereMultipliers[direction][hemisphere]&lt;br /&gt;
		if not multiplier then&lt;br /&gt;
			error('The hemisphere &amp;quot;' .. hemisphere .. '&amp;quot; provided for ' .. direction .. ' is not valid', 2)&lt;br /&gt;
		end&lt;br /&gt;
		decimal = decimal * multiplier&lt;br /&gt;
	end&lt;br /&gt;
	return decimal&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
-- Finds a parameter in a transclusion of {{Coord}}.&lt;br /&gt;
local function coord2text(para,coord) -- this should be changed for languages which do not use Arabic numerals or the degree sign&lt;br /&gt;
	local lat, long = mw.ustring.match(coord,'&amp;lt;span class=&amp;quot;p%-latitude latitude&amp;quot;&amp;gt;([^&amp;lt;]+)&amp;lt;/span&amp;gt;&amp;lt;span class=&amp;quot;p%-longitude longitude&amp;quot;&amp;gt;([^&amp;lt;]+)&amp;lt;/span&amp;gt;')&lt;br /&gt;
	if lat then&lt;br /&gt;
		return tonumber(para == 'longitude' and long or lat)&lt;br /&gt;
	end&lt;br /&gt;
	local result = mw.text.split(mw.ustring.match(coord,'%-?[%.%d]+°[NS] %-?[%.%d]+°[EW]') or '', '[ °]')&lt;br /&gt;
	if para == 'longitude' then result = {result[3], result[4]} end&lt;br /&gt;
	if not tonumber(result[1]) or not result[2] then&lt;br /&gt;
		mw.log('Malformed coordinates value')&lt;br /&gt;
		mw.logObject(para, 'para')&lt;br /&gt;
		mw.logObject(coord, 'coord')&lt;br /&gt;
		return error('Malformed coordinates value', 2)&lt;br /&gt;
	end&lt;br /&gt;
	return tonumber(result[1]) * hemisphereMultipliers[para][result[2]]&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
-- effectively make removeBlanks false for caption and maplink, and true for everything else&lt;br /&gt;
-- if useWikidata is present but blank, convert it to false instead of nil&lt;br /&gt;
-- p.top, p.bottom, and their callers need to use this&lt;br /&gt;
function p.valueFunc(key, value)&lt;br /&gt;
	if value then&lt;br /&gt;
		value = mw.text.trim(value)&lt;br /&gt;
	end&lt;br /&gt;
	if value ~= '' or key == 'caption' or key == 'maplink' then&lt;br /&gt;
		return value&lt;br /&gt;
	elseif key == 'useWikidata' then&lt;br /&gt;
		return false&lt;br /&gt;
	end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
local function getContainerImage(args, map)&lt;br /&gt;
	if args.AlternativeMap then&lt;br /&gt;
		return args.AlternativeMap&lt;br /&gt;
	elseif args.relief and map('image1') ~= '' then&lt;br /&gt;
		return map('image1')&lt;br /&gt;
	else&lt;br /&gt;
		return map('image')&lt;br /&gt;
	end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
function p.top(frame, args, map)&lt;br /&gt;
	if not args then&lt;br /&gt;
		args = getArgs(frame, {frameOnly = true, valueFunc = p.valueFunc})&lt;br /&gt;
	end&lt;br /&gt;
	if not map then&lt;br /&gt;
		map = p.getMapParams(args[1], frame)&lt;br /&gt;
	end&lt;br /&gt;
	local width&lt;br /&gt;
	local default_as_number = tonumber(mw.ustring.match(tostring(args.default_width),&amp;quot;%d*&amp;quot;))&lt;br /&gt;
	if not args.width then&lt;br /&gt;
		width = round((default_as_number or 240) * (tonumber(map('defaultscale')) or 1))&lt;br /&gt;
	elseif mw.ustring.sub(args.width, -2) == 'px' then&lt;br /&gt;
		width = mw.ustring.sub(args.width, 1, -3)&lt;br /&gt;
	else&lt;br /&gt;
		width = args.width&lt;br /&gt;
	end&lt;br /&gt;
	local width_as_number = tonumber(mw.ustring.match(tostring(width),&amp;quot;%d*&amp;quot;)) or 0;&lt;br /&gt;
    if width_as_number == 0 then&lt;br /&gt;
    	-- check to see if width is junk. If it is, then use default calculation&lt;br /&gt;
    	width = round((default_as_number or 240) * (tonumber(map('defaultscale')) or 1))&lt;br /&gt;
    	width_as_number = tonumber(mw.ustring.match(tostring(width),&amp;quot;%d*&amp;quot;)) or 0;&lt;br /&gt;
    end	&lt;br /&gt;
    if args.max_width ~= &amp;quot;&amp;quot; and args.max_width ~= nil then&lt;br /&gt;
        -- check to see if width bigger than max_width&lt;br /&gt;
        local max_as_number = tonumber(mw.ustring.match(args.max_width,&amp;quot;%d*&amp;quot;)) or 0;&lt;br /&gt;
        if width_as_number&amp;gt;max_as_number and max_as_number&amp;gt;0 then&lt;br /&gt;
            width = args.max_width;&lt;br /&gt;
        end&lt;br /&gt;
    end&lt;br /&gt;
	local retval = frame:extensionTag{name = 'templatestyles', args = {src = 'Module:Location map/styles.css'}}&lt;br /&gt;
	if args.float == 'center' then&lt;br /&gt;
		retval = retval .. '&amp;lt;div class=&amp;quot;center&amp;quot;&amp;gt;'&lt;br /&gt;
	end&lt;br /&gt;
	if args.caption and args.caption ~= '' and args.border ~= 'infobox' then&lt;br /&gt;
		retval = retval .. '&amp;lt;div class=&amp;quot;locmap noviewer thumb '&lt;br /&gt;
		if args.float == '&amp;quot;left&amp;quot;' or args.float == 'left' then&lt;br /&gt;
			retval = retval .. 'tleft'&lt;br /&gt;
		elseif args.float == '&amp;quot;center&amp;quot;' or args.float == 'center' or args.float == '&amp;quot;none&amp;quot;' or args.float == 'none' then&lt;br /&gt;
			retval = retval .. 'tnone'&lt;br /&gt;
		else&lt;br /&gt;
			retval = retval .. 'tright'&lt;br /&gt;
		end&lt;br /&gt;
		retval = retval .. '&amp;quot;&amp;gt;&amp;lt;div class=&amp;quot;thumbinner&amp;quot; style=&amp;quot;width:' .. (width + 2) .. 'px'&lt;br /&gt;
		if args.border == 'none' then&lt;br /&gt;
			retval = retval .. ';border:none'&lt;br /&gt;
		elseif args.border then&lt;br /&gt;
			retval = retval .. ';border-color:' .. args.border&lt;br /&gt;
		end&lt;br /&gt;
		retval = retval .. '&amp;quot;&amp;gt;&amp;lt;div style=&amp;quot;position:relative;width:' .. width .. 'px' .. (args.border ~= 'none' and ';border:1px solid lightgray&amp;quot;&amp;gt;' or '&amp;quot;&amp;gt;')&lt;br /&gt;
	else&lt;br /&gt;
		retval = retval .. '&amp;lt;div class=&amp;quot;locmap&amp;quot; style=&amp;quot;width:' .. width .. 'px;'&lt;br /&gt;
		if args.float == '&amp;quot;left&amp;quot;' or args.float == 'left' then&lt;br /&gt;
			retval = retval .. 'float:left;clear:left'&lt;br /&gt;
		elseif args.float == '&amp;quot;center&amp;quot;' or args.float == 'center' then&lt;br /&gt;
			retval = retval .. 'float:none;clear:both;margin-left:auto;margin-right:auto'&lt;br /&gt;
		elseif args.float == '&amp;quot;none&amp;quot;' or args.float == 'none' then&lt;br /&gt;
			retval = retval .. 'float:none;clear:none'&lt;br /&gt;
		else&lt;br /&gt;
			retval = retval .. 'float:right;clear:right'&lt;br /&gt;
		end&lt;br /&gt;
		retval = retval .. '&amp;quot;&amp;gt;&amp;lt;div style=&amp;quot;width:' .. width .. 'px;padding:0&amp;quot;&amp;gt;&amp;lt;div style=&amp;quot;position:relative;width:' .. width .. 'px&amp;quot;&amp;gt;'&lt;br /&gt;
	end&lt;br /&gt;
	local image = getContainerImage(args, map)&lt;br /&gt;
	local currentTitle = mw.title.getCurrentTitle()&lt;br /&gt;
	retval = string.format(&lt;br /&gt;
		'%s[[File:%s|%spx|%s%s|class=notpageimage]]',&lt;br /&gt;
		retval,&lt;br /&gt;
		image,&lt;br /&gt;
		width,&lt;br /&gt;
		args.alt or ((args.label or currentTitle.text) .. ' is located in ' .. map('name')),&lt;br /&gt;
		args.maplink and ('|link=' .. args.maplink) or ''&lt;br /&gt;
	)&lt;br /&gt;
	if args.caption and args.caption ~= '' then&lt;br /&gt;
		if (currentTitle.namespace == 0) and mw.ustring.find(args.caption, '##') then&lt;br /&gt;
			retval = retval .. '[[Category:Pages using location map with a double number sign in the caption]]'&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
	if args.overlay_image then&lt;br /&gt;
		return retval .. '&amp;lt;div style=&amp;quot;position:absolute;top:0;left:0&amp;quot;&amp;gt;[[File:' .. args.overlay_image .. '|' .. width .. 'px|class=notpageimage]]&amp;lt;/div&amp;gt;'&lt;br /&gt;
	else&lt;br /&gt;
		return retval&lt;br /&gt;
	end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
function p.bottom(frame, args, map)&lt;br /&gt;
	if not args then&lt;br /&gt;
		args = getArgs(frame, {frameOnly = true, valueFunc = p.valueFunc})&lt;br /&gt;
	end&lt;br /&gt;
	if not map then&lt;br /&gt;
		map = p.getMapParams(args[1], frame)&lt;br /&gt;
	end&lt;br /&gt;
	local retval = '&amp;lt;/div&amp;gt;'&lt;br /&gt;
	local currentTitle = mw.title.getCurrentTitle()&lt;br /&gt;
	if not args.caption or args.border == 'infobox' then&lt;br /&gt;
		if args.border then&lt;br /&gt;
			retval = retval .. '&amp;lt;div style=&amp;quot;padding-top:0.2em&amp;quot;&amp;gt;'&lt;br /&gt;
		else&lt;br /&gt;
			retval = retval .. '&amp;lt;div style=&amp;quot;font-size:91%;padding-top:3px&amp;quot;&amp;gt;'&lt;br /&gt;
		end&lt;br /&gt;
		retval = retval&lt;br /&gt;
		.. (args.caption or (args.label or currentTitle.text) .. ' (' .. map('name') .. ')')&lt;br /&gt;
		.. '&amp;lt;/div&amp;gt;'&lt;br /&gt;
	elseif args.caption ~= ''  then&lt;br /&gt;
		-- This is not the pipe trick. We're creating a link with no text on purpose, so that CSS can give us a nice image&lt;br /&gt;
		retval = retval .. '&amp;lt;div class=&amp;quot;thumbcaption&amp;quot;&amp;gt;&amp;lt;div class=&amp;quot;magnify&amp;quot;&amp;gt;[[:File:' .. getContainerImage(args, map) .. '|class=notpageimage| ]]&amp;lt;/div&amp;gt;' .. args.caption .. '&amp;lt;/div&amp;gt;'&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	if args.switcherLabel then&lt;br /&gt;
		retval = retval .. '&amp;lt;span class=&amp;quot;switcher-label&amp;quot; style=&amp;quot;display:none&amp;quot;&amp;gt;' .. args.switcherLabel .. '&amp;lt;/span&amp;gt;'&lt;br /&gt;
	elseif args.autoSwitcherLabel then&lt;br /&gt;
		retval = retval .. '&amp;lt;span class=&amp;quot;switcher-label&amp;quot; style=&amp;quot;display:none&amp;quot;&amp;gt;Show map of ' .. map('name') .. '&amp;lt;/span&amp;gt;'&lt;br /&gt;
	end&lt;br /&gt;
	&lt;br /&gt;
	retval = retval .. '&amp;lt;/div&amp;gt;&amp;lt;/div&amp;gt;'&lt;br /&gt;
	if args.caption_undefined then&lt;br /&gt;
		mw.log('Removed parameter caption_undefined used.')&lt;br /&gt;
		local parent = frame:getParent()&lt;br /&gt;
		if parent then&lt;br /&gt;
			mw.log('Parent is ' .. parent:getTitle())&lt;br /&gt;
		end&lt;br /&gt;
		mw.logObject(args, 'args')&lt;br /&gt;
		if currentTitle.namespace == 0 then&lt;br /&gt;
		    retval = retval .. '[[Category:Location maps with removed parameters|caption_undefined]]'&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
	if map('skew') ~= '' or map('lat_skew') ~= '' or map('crosses180') ~= '' or map('type') ~= '' then&lt;br /&gt;
		mw.log('Removed parameter used in map definition ' .. map())&lt;br /&gt;
		if currentTitle.namespace == 0 then&lt;br /&gt;
		    local key = (map('skew') ~= '' and 'skew' or '') ..&lt;br /&gt;
					(map('lat_skew') ~= '' and 'lat_skew' or '') ..&lt;br /&gt;
					(map('crosses180') ~= '' and 'crosses180' or '') ..&lt;br /&gt;
					(map('type') ~= '' and 'type' or '')&lt;br /&gt;
		    retval = retval .. '[[Category:Location maps with removed parameters|' .. key .. ' ]]'&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
	if string.find(map('name'), '|', 1, true) then&lt;br /&gt;
		mw.log('Pipe used in name of map definition ' .. map())&lt;br /&gt;
		if currentTitle.namespace == 0 then&lt;br /&gt;
		   retval = retval .. '[[Category:Location maps with a name containing a pipe]]'&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
	if args.float == 'center' then&lt;br /&gt;
		retval = retval .. '&amp;lt;/div&amp;gt;'&lt;br /&gt;
	end&lt;br /&gt;
	return retval&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
local function markOuterDiv(x, y, imageDiv, labelDiv)&lt;br /&gt;
	return mw.html.create('div')&lt;br /&gt;
		:addClass('od')&lt;br /&gt;
		:cssText('top:' .. round(y, 3) .. '%;left:' .. round(x, 3) .. '%')&lt;br /&gt;
		:node(imageDiv)&lt;br /&gt;
		:node(labelDiv)&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
local function markImageDiv(mark, marksize, label, link, alt, title)&lt;br /&gt;
	local builder = mw.html.create('div')&lt;br /&gt;
		:addClass('id')&lt;br /&gt;
		:cssText('left:-' .. round(marksize / 2) .. 'px;top:-' .. round(marksize / 2) .. 'px')&lt;br /&gt;
		:attr('title', title)&lt;br /&gt;
	if marksize ~= 0 then&lt;br /&gt;
		builder:wikitext(string.format(&lt;br /&gt;
			'[[File:%s|%dx%dpx|%s|link=%s%s|class=notpageimage]]',&lt;br /&gt;
			mark,&lt;br /&gt;
			marksize,&lt;br /&gt;
			marksize,&lt;br /&gt;
			label,&lt;br /&gt;
			link,&lt;br /&gt;
			alt and ('|alt=' .. alt) or ''&lt;br /&gt;
		))&lt;br /&gt;
	end&lt;br /&gt;
	return builder&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
local function markLabelDiv(label, label_size, label_width, position, background, x, marksize)&lt;br /&gt;
	if tonumber(label_size) == 0 then&lt;br /&gt;
		return mw.html.create('div'):addClass('l0'):wikitext(label)&lt;br /&gt;
	end&lt;br /&gt;
	local builder = mw.html.create('div')&lt;br /&gt;
		:cssText('font-size:' .. label_size .. '%;width:' .. label_width .. 'em')&lt;br /&gt;
	local distance = round(marksize / 2 + 1)&lt;br /&gt;
	if position == 'top' then -- specified top&lt;br /&gt;
		builder:addClass('pv'):cssText('bottom:' .. distance .. 'px;left:' .. (-label_width / 2) .. 'em')&lt;br /&gt;
	elseif position == 'bottom' then -- specified bottom&lt;br /&gt;
		builder:addClass('pv'):cssText('top:' .. distance .. 'px;left:' .. (-label_width / 2) .. 'em')&lt;br /&gt;
	elseif position == 'left' or (tonumber(x) &amp;gt; 70 and position ~= 'right') then -- specified left or autodetected to left&lt;br /&gt;
		builder:addClass('pl'):cssText('right:' .. distance .. 'px')&lt;br /&gt;
	else -- specified right or autodetected to right&lt;br /&gt;
		builder:addClass('pr'):cssText('left:' .. distance .. 'px')&lt;br /&gt;
	end&lt;br /&gt;
	builder = builder:tag('div')&lt;br /&gt;
		:wikitext(label)&lt;br /&gt;
	if background then&lt;br /&gt;
		builder:cssText('background-color:' .. background)&lt;br /&gt;
	end&lt;br /&gt;
	return builder:done()&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
local function getX(longitude, left, right)&lt;br /&gt;
	local width = (right - left) % 360&lt;br /&gt;
	if width == 0 then&lt;br /&gt;
		width = 360&lt;br /&gt;
	end&lt;br /&gt;
	local distanceFromLeft = (longitude - left) % 360&lt;br /&gt;
	-- the distance needed past the map to the right equals distanceFromLeft - width. the distance needed past the map to the left equals 360 - distanceFromLeft. to minimize page stretching, go whichever way is shorter&lt;br /&gt;
	if distanceFromLeft - width / 2 &amp;gt;= 180 then&lt;br /&gt;
		distanceFromLeft = distanceFromLeft - 360&lt;br /&gt;
	end&lt;br /&gt;
	return 100 * distanceFromLeft / width&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
local function getY(latitude, top, bottom)&lt;br /&gt;
	return 100 * (top - latitude) / (top - bottom)&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
function p.mark(frame, args, map)&lt;br /&gt;
	if not args then&lt;br /&gt;
		args = getArgs(frame, {wrappers = 'Template:Location map~'})&lt;br /&gt;
	end&lt;br /&gt;
	local mapnames = {}&lt;br /&gt;
	if not map then&lt;br /&gt;
		if args[1] then&lt;br /&gt;
			map = {}&lt;br /&gt;
			for mapname in mw.text.gsplit(args[1], '#', true) do&lt;br /&gt;
				map[#map + 1] = p.getMapParams(mw.ustring.gsub(mapname, '^%s*(.-)%s*$', '%1'), frame)&lt;br /&gt;
				mapnames[#mapnames + 1] = mapname&lt;br /&gt;
			end&lt;br /&gt;
			if #map == 1 then map = map[1] end&lt;br /&gt;
		else&lt;br /&gt;
			map = p.getMapParams('World', frame)&lt;br /&gt;
			args[1] = 'World'&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
	if type(map) == 'table' then&lt;br /&gt;
		local outputs = {}&lt;br /&gt;
		local oldargs = args[1]&lt;br /&gt;
		for k,v in ipairs(map) do&lt;br /&gt;
			args[1] = mapnames[k]&lt;br /&gt;
			outputs[k] = tostring(p.mark(frame, args, v))&lt;br /&gt;
		end&lt;br /&gt;
		args[1] = oldargs&lt;br /&gt;
		return table.concat(outputs, '#PlaceList#') .. '#PlaceList#'&lt;br /&gt;
	end&lt;br /&gt;
	local x, y, longitude, latitude&lt;br /&gt;
	longitude = decdeg(args.lon_deg, args.lon_min, args.lon_sec, args.lon_dir, args.long, 'longitude')&lt;br /&gt;
	latitude = decdeg(args.lat_deg, args.lat_min, args.lat_sec, args.lat_dir, args.lat, 'latitude')&lt;br /&gt;
	if args.excludefrom then&lt;br /&gt;
		-- If this mark is to be excluded from certain maps entirely (useful in the context of multiple maps)&lt;br /&gt;
		for exclusionmap in mw.text.gsplit(args.excludefrom, '#', true) do&lt;br /&gt;
			-- Check if this map is excluded. If so, return an empty string.&lt;br /&gt;
			if args[1] == exclusionmap then&lt;br /&gt;
				return ''&lt;br /&gt;
			end&lt;br /&gt;
		end&lt;br /&gt;
			&lt;br /&gt;
	end&lt;br /&gt;
	local builder = mw.html.create()&lt;br /&gt;
	local currentTitle = mw.title.getCurrentTitle()&lt;br /&gt;
	if args.coordinates then&lt;br /&gt;
--		Temporarily removed to facilitate infobox conversion. See [[Wikipedia:Coordinates in infoboxes]]&lt;br /&gt;
&lt;br /&gt;
--		if longitude or latitude then&lt;br /&gt;
--			error('Coordinates from [[Module:Coordinates]] and individual coordinates cannot both be provided')&lt;br /&gt;
--		end&lt;br /&gt;
		longitude = coord2text('longitude', args.coordinates)&lt;br /&gt;
		latitude = coord2text('latitude', args.coordinates)&lt;br /&gt;
	elseif not longitude and not latitude and args.useWikidata then&lt;br /&gt;
		-- If they didn't provide either coordinate, try Wikidata. If they provided one but not the other, don't.&lt;br /&gt;
		local entity = mw.wikibase.getEntity()&lt;br /&gt;
		if entity and entity.claims and entity.claims.P625 and entity.claims.P625[1].mainsnak.snaktype == 'value' then&lt;br /&gt;
			local value = entity.claims.P625[1].mainsnak.datavalue.value&lt;br /&gt;
			longitude, latitude = value.longitude, value.latitude&lt;br /&gt;
		end&lt;br /&gt;
		if args.link and (currentTitle.namespace == 0) then&lt;br /&gt;
			builder:wikitext('[[Category:Location maps with linked markers with coordinates from Wikidata]]')	&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
	if not longitude then&lt;br /&gt;
		error('No value was provided for longitude')&lt;br /&gt;
	elseif not latitude then&lt;br /&gt;
		error('No value was provided for latitude')&lt;br /&gt;
	end&lt;br /&gt;
	if currentTitle.namespace &amp;gt; 0 then&lt;br /&gt;
		if (not args.lon_deg) ~= (not args.lat_deg) then&lt;br /&gt;
			builder:wikitext('[[Category:Location maps with different longitude and latitude precisions|Degrees]]')&lt;br /&gt;
		elseif (not args.lon_min) ~= (not args.lat_min) then&lt;br /&gt;
			builder:wikitext('[[Category:Location maps with different longitude and latitude precisions|Minutes]]')&lt;br /&gt;
		elseif (not args.lon_sec) ~= (not args.lat_sec) then&lt;br /&gt;
			builder:wikitext('[[Category:Location maps with different longitude and latitude precisions|Seconds]]')&lt;br /&gt;
		elseif (not args.lon_dir) ~= (not args.lat_dir) then&lt;br /&gt;
			builder:wikitext('[[Category:Location maps with different longitude and latitude precisions|Hemisphere]]')&lt;br /&gt;
		elseif (not args.long) ~= (not args.lat) then&lt;br /&gt;
			builder:wikitext('[[Category:Location maps with different longitude and latitude precisions|Decimal]]')&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
	if ((tonumber(args.lat_deg) or 0) &amp;lt; 0) and ((tonumber(args.lat_min) or 0) ~= 0 or (tonumber(args.lat_sec) or 0) ~= 0 or (args.lat_dir and args.lat_dir ~='')) then&lt;br /&gt;
		builder:wikitext('[[Category:Location maps with negative degrees and minutes or seconds]]')&lt;br /&gt;
	end&lt;br /&gt;
	if ((tonumber(args.lon_deg) or 0) &amp;lt; 0) and ((tonumber(args.lon_min) or 0) ~= 0 or (tonumber(args.lon_sec) or 0) ~= 0 or (args.lon_dir and args.lon_dir ~= '')) then&lt;br /&gt;
		builder:wikitext('[[Category:Location maps with negative degrees and minutes or seconds]]')&lt;br /&gt;
	end&lt;br /&gt;
	if (((tonumber(args.lat_min) or 0) &amp;lt; 0) or ((tonumber(args.lat_sec) or 0) &amp;lt; 0)) then&lt;br /&gt;
		builder:wikitext('[[Category:Location maps with negative degrees and minutes or seconds]]')&lt;br /&gt;
	end&lt;br /&gt;
	if (((tonumber(args.lon_min) or 0) &amp;lt; 0) or ((tonumber(args.lon_sec) or 0) &amp;lt; 0)) then&lt;br /&gt;
		builder:wikitext('[[Category:Location maps with negative degrees and minutes or seconds]]')&lt;br /&gt;
	end&lt;br /&gt;
	if args.skew or args.lon_shift or args.markhigh then&lt;br /&gt;
		mw.log('Removed parameter used in invocation.')&lt;br /&gt;
		local parent = frame:getParent()&lt;br /&gt;
		if parent then&lt;br /&gt;
			mw.log('Parent is ' .. parent:getTitle())&lt;br /&gt;
		end&lt;br /&gt;
		mw.logObject(args, 'args')&lt;br /&gt;
		if currentTitle.namespace == 0 then&lt;br /&gt;
			local key = (args.skew and 'skew' or '') ..&lt;br /&gt;
						(args.lon_shift and 'lon_shift' or '') ..&lt;br /&gt;
						(args.markhigh and 'markhigh' or '')&lt;br /&gt;
			builder:wikitext('[[Category:Location maps with removed parameters|' .. key ..' ]]')&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
	if map('x') ~= '' then&lt;br /&gt;
		x = tonumber(mw.ext.ParserFunctions.expr(map('x', { latitude, longitude })))&lt;br /&gt;
	else&lt;br /&gt;
		x = tonumber(getX(longitude, map('left'), map('right')))&lt;br /&gt;
	end&lt;br /&gt;
	if map('y') ~= '' then&lt;br /&gt;
		y = tonumber(mw.ext.ParserFunctions.expr(map('y', { latitude, longitude })))&lt;br /&gt;
	else&lt;br /&gt;
		y = tonumber(getY(latitude, map('top'), map('bottom')))&lt;br /&gt;
	end&lt;br /&gt;
	if (x &amp;lt; 0 or x &amp;gt; 100 or y &amp;lt; 0 or y &amp;gt; 100) and not args.outside then&lt;br /&gt;
		mw.log('Mark placed outside map boundaries without outside flag set. x = ' .. x .. ', y = ' .. y)&lt;br /&gt;
		local parent = frame:getParent()&lt;br /&gt;
		if parent then&lt;br /&gt;
			mw.log('Parent is ' .. parent:getTitle())&lt;br /&gt;
		end&lt;br /&gt;
		mw.logObject(args, 'args')&lt;br /&gt;
		if currentTitle.namespace == 0 then&lt;br /&gt;
			local key = currentTitle.prefixedText&lt;br /&gt;
			builder:wikitext('[[Category:Location maps with marks outside map and outside parameter not set|' .. key .. ' ]]')&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
	local mark = args.mark or map('mark')&lt;br /&gt;
	if mark == '' then&lt;br /&gt;
		mark = 'Red pog.svg'&lt;br /&gt;
	end&lt;br /&gt;
	local marksize = tonumber(args.marksize) or tonumber(map('marksize')) or 8&lt;br /&gt;
	local imageDiv = markImageDiv(mark, marksize, args.label or mw.title.getCurrentTitle().text, args.link or '', args.alt, args[2])&lt;br /&gt;
	local labelDiv&lt;br /&gt;
	if args.label and args.position ~= 'none' then&lt;br /&gt;
		labelDiv = markLabelDiv(args.label, args.label_size or 91, args.label_width or 6, args.position, args.background, x, marksize)&lt;br /&gt;
	end&lt;br /&gt;
	return builder:node(markOuterDiv(x, y, imageDiv, labelDiv))&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
local function switcherSeparate(s)&lt;br /&gt;
	if s == nil then return {} end&lt;br /&gt;
	local retval = {}&lt;br /&gt;
	for i in string.gmatch(s .. '#', '([^#]*)#') do&lt;br /&gt;
		i = mw.text.trim(i)&lt;br /&gt;
		retval[#retval + 1] = (i ~= '' and i)&lt;br /&gt;
	end&lt;br /&gt;
	return retval&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
function p.main(frame, args, map)&lt;br /&gt;
	local caption_list = {}&lt;br /&gt;
	if not args then&lt;br /&gt;
		args = getArgs(frame, {wrappers = 'Template:Location map', valueFunc = p.valueFunc})&lt;br /&gt;
	end&lt;br /&gt;
	if args.useWikidata == nil then&lt;br /&gt;
		args.useWikidata = true&lt;br /&gt;
	end&lt;br /&gt;
	if not map then&lt;br /&gt;
		if args[1] then&lt;br /&gt;
			map = {}&lt;br /&gt;
			for mapname in string.gmatch(args[1], '[^#]+') do&lt;br /&gt;
				map[#map + 1] = p.getMapParams(mw.ustring.gsub(mapname, '^%s*(.-)%s*$', '%1'), frame)&lt;br /&gt;
			end&lt;br /&gt;
			if args['caption'] then&lt;br /&gt;
				if args['caption'] == &amp;quot;&amp;quot; then&lt;br /&gt;
					while #caption_list &amp;lt; #map do&lt;br /&gt;
						caption_list[#caption_list + 1] = args['caption']&lt;br /&gt;
					end&lt;br /&gt;
				else&lt;br /&gt;
					for caption in mw.text.gsplit(args['caption'], '##', true) do&lt;br /&gt;
						caption_list[#caption_list + 1] = caption&lt;br /&gt;
					end&lt;br /&gt;
				end&lt;br /&gt;
			end&lt;br /&gt;
			if #map == 1 then map = map[1] end&lt;br /&gt;
		else&lt;br /&gt;
			map = p.getMapParams('World', frame)&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
	if type(map) == 'table' then&lt;br /&gt;
		local altmaps = switcherSeparate(args.AlternativeMap)&lt;br /&gt;
		if #altmaps &amp;gt; #map then&lt;br /&gt;
			error(string.format('%d AlternativeMaps were provided, but only %d maps were provided', #altmaps, #map))&lt;br /&gt;
		end&lt;br /&gt;
		local overlays = switcherSeparate(args.overlay_image)&lt;br /&gt;
		if #overlays &amp;gt; #map then&lt;br /&gt;
			error(string.format('%d overlay_images were provided, but only %d maps were provided', #overlays, #map))&lt;br /&gt;
		end&lt;br /&gt;
		if #caption_list &amp;gt; #map then&lt;br /&gt;
			error(string.format('%d captions were provided, but only %d maps were provided', #caption_list, #map))&lt;br /&gt;
		end&lt;br /&gt;
		local outputs = {}&lt;br /&gt;
		args.autoSwitcherLabel = true&lt;br /&gt;
		for k,v in ipairs(map) do&lt;br /&gt;
			args.AlternativeMap = altmaps[k]&lt;br /&gt;
			args.overlay_image = overlays[k]&lt;br /&gt;
			args.caption = caption_list[k]&lt;br /&gt;
			outputs[k] = p.main(frame, args, v)&lt;br /&gt;
		end&lt;br /&gt;
		return '&amp;lt;div class=&amp;quot;switcher-container&amp;quot;&amp;gt;' .. table.concat(outputs) .. '&amp;lt;/div&amp;gt;'&lt;br /&gt;
	else&lt;br /&gt;
		return p.top(frame, args, map) .. tostring( p.mark(frame, args, map) ) .. p.bottom(frame, args, map)&lt;br /&gt;
	end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
return p&lt;/div&gt;</summary>
		<author><name>Wikipedia&gt;Elli</name></author>
	</entry>
</feed>