Modulo:Mapi
Dokumentizo por ica modulo povas kreesar ye Modulo:Mapi/dokumentado
-- modulo Mapi – helpaji pri mapi en shabloni (i.a. por shablono "Loko")
local mapi = -- listo di mapi por dilatar future
{ -- PL
["Poland adm location map.svg"] = {13.8, 55.2, 24.5, 48.7},
["Relief_Map_of_Poland.svg"] = {13.8, 55.2, 24.5, 48.7},
["Lodzkie_mapa_fizyczna.png"] = {18.0744, 52.3934, 20.6534, 50.8434}
}
-- ******************************************
function num (lat_or_lon, deg_or_min_or_sec)
if deg_or_min_or_sec == "deg" then
return string.sub(lat_or_lon,1,2);
end
if deg_or_min_or_sec == "min" then
return string.sub(lat_or_lon,4,5);
end
if deg_or_min_or_sec == "sec" then
return string.sub(lat_or_lon,7,8);
end
end
-- //////////////////////////////////////////
function coords (nomo, mapoarkivo, latitudo, longitudo)
local x1 = mapi[mapoarkivo][1];
local y1 = mapi[mapoarkivo][2];
local x2 = mapi[mapoarkivo][3];
local y2 = mapi[mapoarkivo][4];
local x0 = x2 - x1;
local y0 = y1 - y2;
local N = tonumber(num(latitudo,"deg")) + tonumber(num(latitudo,"min"))/60 + tonumber(num(latitudo,"sec"))/3600;
local E = tonumber(num(longitudo,"deg")) + tonumber(num(longitudo,"min"))/60 + tonumber(num(longitudo,"sec"))/3600;
local x9 = E - x1;
local y9 = y1 - N;
local x = x9/x0;
local y = y9/y0;
x9 = x;
y9 = y;
local n1 = math.pow(10, 2 or 0);
x9 = x9 * n1
if x9 >= 0 then x9 = math.floor(x9 + 0.5) else x9 = math.ceil(x9 - 0.5) end
x = x9 / n1
local n2 = math.pow(10, 2 or 0)
y9 = y9 * n2
if y9 >= 0 then y9 = math.floor(y9 + 0.5) else y9 = math.ceil(y9 - 0.5) end
y = y9 / n2
return "{{Etiketo arkivo komenco|image={{{"..nomo.."|}}}|width=250}}{{Etiketo mikra arkivo|x="..tostring(x).."|y="..tostring(y).."|scale=250|text=<span style=\"color:darkblue;\">'''<big>• {{{DetalozaMapoEtiketo|←}}}</big>'''</span>}}{{Etiketo arkivo fino}}";
end