Module:MapCoordinates
ⵜⵉⴼⵔⴰⵙ
local p = {}
function p.getMapframe(frame)
local qid = frame.args.qid or 'Q12345' -- Replace with the actual QID
local entity = mw.wikibase.getEntityObject(qid)
if entity and entity.claims and entity.claims.P625 then
local coordinates = entity.claims.P625[1].mainsnak.datavalue.value
local latitude = coordinates.latitude
local longitude = coordinates.longitude
-- Generate Kartographer map code without the text attribute
local mapCode = string.format(
'<mapframe style="width:350px; height:350px;" zoom="13" center="%f,%f"></mapframe>',
latitude, longitude
)
return mapCode
else
return 'No coordinates found in Wikidata for the given QID'
end
end
return p