Module:Location map: Difference between revisions

no edit summary
No edit summary
No edit summary
Line 397: Line 397:
-- error('Coordinates from [[Module:Coordinates]] and individual coordinates cannot both be provided')
-- error('Coordinates from [[Module:Coordinates]] and individual coordinates cannot both be provided')
-- end
-- end
longitude = coord2text('longitude', args.coordinates)
latitude = coord2text('latitude', args.coordinates)
elseif not longitude and not latitude and args.useWikidata then
-- If they didn't provide either coordinate, try Wikidata. If they provided one but not the other, don't.
if entity and entity.claims and entity.claims.P625 and entity.claims.P625[1].mainsnak.snaktype == 'value' then
local value = entity.claims.P625[1].mainsnak.datavalue.value
longitude, latitude = value.longitude, value.latitude
end
if args.link and (currentTitle.namespace == 0) then
if args.link and (currentTitle.namespace == 0) then
builder:wikitext('[[Category:Location maps with linked markers with coordinates from Wikidata]]')
builder:wikitext('[[Category:Location maps with linked markers with coordinates from Wikidata]]')