Module:Sandbox/trappist the monk/wd lat lon: Difference between revisions
imported>Legoktm Replace Module:No globals with require( "strict" ) |
(No difference)
|
Latest revision as of 20:59, 23 October 2022
Documentation for this module may be created at Module:Sandbox/trappist the monk/wd lat lon/doc
require('strict');
local get_args = require ('Module:Arguments').getArgs;
--[[
{{#invoke:Sandbox/trappist_the_monk/wd_lat_lon|main}}
]]
local function wikidata_lat_lon_get()
local qid = mw.wikibase.getEntityIdForCurrentPage(); -- get the qid for the current page
if qid then
local value_t = mw.wikibase.getBestStatements (qid, 'P625')[1].mainsnak.datavalue.value; --point to the value table
return value_t.latitude, value_t.longitude;
end
end
local function main()
local lat, lon = wikidata_lat_lon_get();
if lat then
return 'latitude: ' .. lat .. '; longitude: ' .. lon;
end
return 'no lat/lon'
end
return {
main = main
}