ഘടകം:Slippymap/sandbox
ഈ ഘടകത്തിന്റെ വിവരണം ഘടകം:Slippymap/sandbox/വിവരണം എന്ന താളിൽ നിർമ്മിക്കാവുന്നതാണ്
local p = {}
function p.slippymap(frame)
-- Get arguments from the template or directly from the page
local args = frame:getParent().args
local lat = args["lat"] or "0" -- Default latitude
local lon = args["lon"] or "0" -- Default longitude
local text = args["text"] or "Marker" -- Default marker text
local logo = args["logo"] or "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
-- Kartographer map rendering
local mapHtml = mw.html.create("div")
mapHtml:addClass("kartographer-map")
mapHtml:attr("style", "width: 100%; height: 400px;")
mapHtml:wikitext('{{#invoke:Kartographer|map|' .. lat .. ',' .. lon .. '|zoom=13|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