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 = {
= "Finnish dialect location map.svg",
= function (lat, lon) return (lon - 12) * 100 / 20.5 end,
= 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("]") .. table.concat(pegs, "") .. "</div>"
end
return export