ഘടകം:Slippymap/sandbox
ഈ ഘടകത്തിന്റെ വിവരണം ഘടകം:Slippymap/sandbox/വിവരണം എന്ന താളിൽ നിർമ്മിക്കാവുന്നതാണ്
local p = {}
function p.slippymap(frame)
-- Get arguments from the template
local args = frame:getParent().args
local lat = args["lat"] or "0" -- Default latitude
local lon = args["lon"] or "0" -- Default longitude
local height = args["height"] or "400px" -- Default height
local width = args["width"] or "100%" -- Default width
local zoom = args["zoom"] or "13" -- Default zoom level
local text = args["text"] or "Marker" -- Default marker text
local logo = args["logo"] or "https://schoolwiki.in/File:63rd_state_kalolsavam_logo.png" -- Default logo image (complete URL)
-- Ensure lat and lon are numeric
lat = tonumber(lat) or 0
lon = tonumber(lon) or 0
zoom = tonumber(zoom) or 13
-- Kartographer map rendering
local mapHtml = mw.html.create("div")
mapHtml:addClass("kartographer-map")
mapHtml:attr("style", "width: " .. width .. "; height: " .. height .. ";")
-- Add Kartographer map invocation
mapHtml:wikitext('{{#invoke:Kartographer|map|' .. lat .. ',' .. lon .. '|zoom=' .. zoom .. '|markers=' .. lat .. ',' .. lon .. '|' .. text .. '}}')
-- Logo as an image
local logoHtml = mw.html.create("div")
logoHtml:addClass("logo")
logoHtml:attr("style", "position: absolute; bottom: 10px; left: 10px;")
logoHtml:wikitext('[[File:' .. logo .. '|100px|link=]]')
-- Return the map and logo HTML
return tostring(mapHtml) .. tostring(logoHtml)
end
return p