Module:MapMarkers

local p = {} function p.mapmarkers( f ) local args = f:getParent.args

-- Currently only 1 map local map = 'Topographic Map.jpg' -- local borderCoords = {t=7.2,r=92.8,b=92.8,l=7.2}

local mapsize = args.mapsize or 300 local markersize = args.markersize or 10 local markercolor = args.markercolor or '#f40' local markericon = args.markericon or '' local opacity = args.opacity or 1 local text = args.text or '' local float = args.float or '' local link = args.link or ''

local markers = {}

for _,l in ipairs(args) do   local ms = markersize local mc = markercolor local ml = link

local mis = {} mis[1] = markericon

local parts,i = {}, 0 for part in string.gmatch(l..',', "([^,]*),") do     table.insert(parts,part:match "^%s*(.-)%s*$") end

if #parts > 1 then local lat = parts[1] local lon = parts[2] local mt = 'lat '..lat..', lon '..lon

ms = (#parts > 2 and string.len(parts[3]) > 0 and parts[3]) or ms     mc = (#parts > 3 and string.len(parts[4]) > 0 and parts[4]) or mc      mt = (#parts > 4 and string.len(parts[5]) > 0 and parts[5]..'&#010;'..mt) or mt      ml = (#parts > 5 and string.len(parts[6]) > 0 and parts[6]) or ml

i = 6

while #parts > i do       mis[i - 5] = parts[i + 1] i = i + 1 end

-- local leftPad = 100*((lon-borderCoords.l)/(borderCoords.r-borderCoords.l) - ms/(2*mapsize)) -- local topPad = 100*((lat-borderCoords.t)/(borderCoords.b-borderCoords.t) - ms/(2*mapsize))

local leftPad = 100*((lon / 100) - ms/(2*mapsize)) local topPad = 100*((lat / 100) - ms/(2*mapsize))

local marker = ' 0 and string.len(mis[1]) > 0 then marker = marker ..'">   '      else        marker = marker ..';width:'..ms..'px;height:'..ms..'px;border-radius:50%;background-color:'..mc..';border:1px solid black" title="'..mt..'> '      end

table.insert(markers, marker) end end

local subtitle = '' if text ~= '' then subtitle = '\n|-\n| align="middle" | '..text end

local result = '{| class="wikitable"'

if float ~= '' then result = result .. 'style="float:'..float..'"' end

result = result .. '\n|-\n| '..table.concat(markers)..' '..subtitle..'\n|}'

return result end return p