Content deleted Content added
Create sandbox version of Module:Infobox mapframe |
check for OSM relation id |
||
Line 22:
local coordStatements = mw.wikibase.getBestStatements(item_id, 'P625')
if not coordStatements or #coordStatements == 0 then
return false
end
return true
end
function hasWikidataOSMrelation(item_id)
if not(item_id) or not(mw.wikibase.isValidEntityId(item_id)) or not(mw.wikibase.entityExists(item_id)) then
return false
end
local OSMRelationStatements = mw.wikibase.getBestStatements(item_id, 'P402')
if not OSMRelationStatements or #OSMRelationStatements == 0 then
return false
end
Line 45 ⟶ 56:
p._main = function(_config)
local config = setCleanArgs(_config)
local wikidataId = config.id or mw.wikibase.getEntityIdForCurrentPage()
-- Require wikidata item with coords, so something will definetly be displayed▼
if not wikidataId then
return ''
end
if not hasWikidataCoords(config.id or mw.wikibase.getEntityIdForCurrentPage()) then
return ''
Line 86 ⟶ 102:
-- Point
if not hasWikidataOSMrelation(wikidataId) then
if config.id then args.id3 = config.id end end
local mapframe = mf._main(args)
return mapframe
|