Documentation for this module may be created at Module:VisitedMap/doc
local p = {}
function p.render(frame)
local qids_str = frame.args[1] or ""
local map_params = {
latitude = "15",
longitude = "13.5",
zoom = "2",
width = "100%",
height = "500",
align = "center"
}
if qids_str == "" or qids_str == nil then
return frame:extensionTag('mapframe', '', map_params)
end
local qids = {}
for qid in string.gmatch(qids_str, '([^,]+)') do
table.insert(qids, mw.text.trim(qid))
end
local shapes = {}
local chunk_size = 20
for i = 1, #qids, chunk_size do
local chunk = {}
for j = i, math.min(i + chunk_size - 1, #qids) do
table.insert(chunk, qids[j])
end
table.insert(shapes, {
type = "ExternalData",
service = "geoshape",
ids = table.concat(chunk, ","),
properties = {
fill = "#3366cc",
["fill-opacity"] = 0.5,
stroke = "#ffffff",
["stroke-width"] = 1,
}
})
end
return frame:extensionTag('mapframe', mw.text.jsonEncode(shapes), map_params)
end
return p