Toggle menu
Toggle personal menu
Not logged in
Your IP address will be publicly visible if you make any edits.

Module:Mapframe

From Alternative Lifestyle Wiki
More languages
More actions
Revision as of 13:37, 27 June 2024 by 162.213.119.13 (talk) (Replaced content with "-- Module:SimpleMapframe local p = {} -- Function to generate the mapframe function p.map(frame) -- Retrieve the parameters from the parent frame local args = frame:getParent().args -- Default values local lat = args.lat or "0" -- Latitude local lon = args.lon or "0" -- Longitude local zoom = args.zoom or "10" -- Default zoom level local width = args.width or "300" -- Width in pixels local height = args.height or "200" -- Height...")

Documentation for this module may be created at Module:Mapframe/doc

-- Module:SimpleMapframe
local p = {}

-- Function to generate the mapframe
function p.map(frame)
    -- Retrieve the parameters from the parent frame
    local args = frame:getParent().args
    
    -- Default values
    local lat = args.lat or "0" -- Latitude
    local lon = args.lon or "0" -- Longitude
    local zoom = args.zoom or "10" -- Default zoom level
    local width = args.width or "300" -- Width in pixels
    local height = args.height or "200" -- Height in pixels
    
    -- Generate the mapframe HTML
    local mapframe = mw.text.tag('mapframe', {
        latitude = lat,
        longitude = lon,
        zoom = zoom,
        width = width .. "px",
        height = height .. "px",
        align = "center"
    })
    
    return mapframe
end

return p