ਮੌਡਿਊਲ:AutoMapZoom
Documentation for this module may be created at ਮੌਡਿਊਲ:AutoMapZoom/doc
local p = {}
-- Given an input area, return a map zoom level to use with mw:Extension:Kartographer. Defaults to mapzoom=15.
function p.autoMapZoom(frame)
local sizestr,null = frame.args[1]:gsub("%D+%.?%D+", ""):gsub(",","")
local size = tonumber(sizestr) or 0
local LUT = { 5000000, 1000000, 100000, 50000, 10000, 2000, 150, 50, 19, 14, 5, 1, 0.5 }
for zoom, scale in ipairs(LUT) do
if size > scale then
return zoom+1
end
end
return 15
end
return p