Module:fi-dialects/map
Appearance
- The following documentation is located at Module:fi-dialects/map/documentation. [edit]
- Useful links: root page • root page’s subpages • links • transclusions • testcases • sandbox
Implements parts of the Finnish dialectal data map.
local export = {}
local sin = math.sin
local cos = math.cos
-- image: name of image.
-- x: function that takes lat,long (degrees °N, °E respectively) and returns 0-100% (from left to right on the map).
-- y: function that takes lat,long (degrees °N, °E respectively) and returns 0-100% (from top to bottom on the map).
local parameters = {
["image"] = "Finnish dialect location map.svg",
["x"] = function (lat, lon) return (lon - 12) * 100 / 20.5 end,
["y"] = function (lat, lon) return (lat - 70.5) * -100 / 11.5 end
}
function export.show(args)
local frame = args.frame
local parishes = args.parishes
local peg = args.peg
local size = args.size and "|" .. args.size or ""
local pegs = {}
for _, parish in ipairs(parishes) do
local lat, lon = parish:getCoordinates()
local x = parameters.x(lat, lon)
local y = parameters.y(lat, lon)
table.insert(pegs, peg(parish, y .. "%", x .. "%"))
end
return '<div style="position:relative;display:inline-block;">' .. frame:preprocess("[[File:" .. parameters.image .. size .. "|link=|class=fi-dial-map-map]]") .. table.concat(pegs, "") .. "</div>"
end
return export